6 ms·
New blog about my journey to develop a Common Lisp 3D software
- mark_l_watson 5y agoI just took a quick look - nice stuff! (bookmarked for later). I spent most of this morning refactoring some old Common Lisp code, separating the LispWorks CAPI code, planning on adding Common Graphics and McCLIM front ends also. Common Lisp (for me) is the least resistance of any programming language I use. Love it.
- whartung 5y agoI certainly wouldn't call it "least resistance", simply because I never use it enough to be completely comfortable with even some of the basics (i.e. loop). Always hitting the hyperspec about something. But, even then, I find it's much easier to write in simply because of its syntax. I use dashes-in-all-my-identifiers. Those are very easy to type. Most of my routines break up easily in to "bunch of assignments and destructuring in let" and then "code to work on those". All of the argument lists and structures and what not are broken in to their component bits early on, then its "just code". It's very stream of consciousness then. That said, however, I have not done a lot of interfacing to external libraries. It's mostly just me and the listener. But, even with me constantly bouncing back and forth doing prefix math (my little brain doesn't think far enough ahead to naturally use prefix math), it still flows really easily.
- throw10920 5y agoMy experience with CL (as someone who loves it very much) that while the syntax is relatively easy to use (with the CLHS caveats that you mentioned - does the list or symbol come first for GETF? is it TYPE-OF or TYPEOF?), there's friction around getting set up for the first time. I've tried to teach it to many people before and getting a sane development environment is orders of magnitude harder than with Python. I find your "stream of consciousness" description to be very accurate, and it's one of the most addicting parts of it for me. Now, if only it scaled better to larger systems, it would be perfect - I would like to have better types and type-checking, and macros that have access to type information, for starters...
- Jach 5y agoWhat's the process look like for Python these days, after you install Python itself (or are made aware of the system Python if there is one)? IDLE was pretty bad back in the day and even though it was 'easy' I wouldn't have recommended it to newcomers. Assuming you can convince people to give emacs a try (shouldn't be hard if they're convinced to give Lisp a try and otherwise don't have preexisting biases against emacs for other reasons), getting setup for Lisp is as easy as installing Portacle (https://portacle.github.io/ https://portacle.github.io/). It and any decent Lisp setup includes things like a hotkey to autocomplete, so you just type 'typ' and tab or whatever, and out pops suggestions like 'type', 'typep', 'type-of', ... and so you don't have to remember spelling; similarly they all should have some sort of intellisense to minimize trips to the CLHS or jumps to source code. I'm a vim head (which is why I don't know what newbie setups are like anymore apart from doing it in vim) but even when I type "(getf " I'm shown at the bottom "(getf PLACE INDICATOR &OPTIONAL (DEFAULT NIL))". If that's not enough, I can jump to source with "ctrl+]" (really nice being able to jump to the Lisp implementation's source for built-ins too without having to do anything special -- can even modify it live by adding print statements or whatever I want), or typing ",s" to get the symbol's describe output (I mainly like it for getting the docstring -- if memory serves though Portacle gives you the docstring with the lambda list in an intellisense popup automatically, like a Java IDE), and if I really need to ",h" opens a browser tab to the hyperspec page on that symbol. If Portacle isn't one's cup of tea, it becomes a bit harder, but I don't think it's "orders of magnitude" harder... Compared to setting up a local (L|W)AMP environment back in the mid-late 2000s, which tons of teens learning PHP did, it's a piece of cake. You install a Lisp implementation (like SBCL -- http://www.sbcl.org/platform-table.html http://www.sbcl.org/platform-table.html if your distro doesn't package it/have a recent version), configure it to use Quicklisp (a couple commands -- https://www.quicklisp.org/beta/ https://www.quicklisp.org/beta/), and consult the CL Cookbook for further basic steps on setting up the best environment you can for a variety of editors (https://lispcookbook.github.io/cl-cookbook/editor-support.html https://lispcookbook.github.io/cl-cookbook/editor-support.ht... -- emacs, vim, VS Code, Atom, Sublime...). For scaling, CL has scaled to multi-million lines of code projects, it scales fine. If you want more sophisticated type checking, there have been solutions over time, but in case you missed the latest and greatest take on it: https://github.com/coalton-lang/coalton https://github.com/coalton-lang/coalton
- Jach 5y ago> my little brain doesn't think far enough ahead to naturally use prefix math Nor mine, it's the only Lisp-ism I choose not to try and integrate apart from trivial expressions. (I do rather like not having to type extra +s when I'm adding multiple things together.) Similarly I disliked my dad's postfix HP calculator apart from trivial things. But this is Lisp, and my worries were solved when I was still just a toddler: https://github.com/quil-lang/cmu-infix https://github.com/quil-lang/cmu-infix Being in my .sbclrc file I can always use infix math whenever I need, and it's trivial to add it as a dependency to an asdf system.
- kaveh808 5y agoI'm surprised how little of my code, even in a 3D graphics system, is basic math on numerical types. It's mostly on points and matrices and the like, where I prefer point-add (or p+) to overloaded infix operators. I also prefer dashes to camel case names. Plus the Symbolics keyboards let you type parens without having to use the shift key.
- dwringer 5y agoI see a lot of people using loop in the wild, but personally I took to heart Paul Graham's advice from ANSI Common Lisp to generally avoid it because of the exact reason you've suggested, it's complicated and honestly not very "Lispy". I just use do instead, and I'll admit it's not the most streamlined compared to other languages but it does the job in a simple and predictable way.
- kaveh808 5y agoI only use loop if I'm iterating over multiple sequences or doing something tricky. Otherwise I use dolist, dotimes, map, mapcar. But it's nice to know loop is there...
- dreamcompiler 5y agoSame here. Loop is handy for iterating over hash-tables and collecting. Beyond that I prefer tail recursion, map, reduce, some/every, and the do forms.
- kaveh808 5y agoI'd love to hear more about your project. I've been looking at McClim and CLOG for UI. Don't know if they support OpenGL viewports. I agree with the "least resistance" notion. The way I've always thought about it is that Lisp is the only language that doesn't fight me when I'm using it.
- mark_l_watson 5y agoI have a GUI example Knowledge Graph Navigator in my Lisp book [1] and I am separating out for a new edition the library code and the CAPI code. I also have plans to supply UIs written with McCLIM and Open Graphics. I am motivated because some readers said that having a CAPI example was useful to them. I write just for fun, and I tend to put emphasis on material where I get the most feedback. [1] slide the price to ‘free’ https://leanpub.com/lovinglisp https://leanpub.com/lovinglisp
- Keyframe 5y agoGood luck! There were at least two big graphics programs which relied on Lisp and prooved how useful ot was/is in those environments. Talking, of course, avout AutoCAD's AutoLISP and Visual Lisp and transformativr and great (grand even) late Nichimen's Mirai (franz).
- agumonkey 5y agoI did gather a few things I found about nichimen mirai and it's symbolics-g roots on https://old.reddit.com/r/nichimen https://old.reddit.com/r/nichimen If you know some stuff that is not there, feel free to submit some links :)
- kaveh808 5y agoThanks. I've never looked at AutoCAD, but was aware of Mirai. It was originally the S-Geometry suite from Symbolics, sold to Nichimen as Mirai, then sold to IzWare where it disappeared. Would be great if that code could be open-sourced, for historical reasons if nothing else.
- AceJohnny2 5y agoRelated: https://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp https://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp
- marai2 5y ago@kaveh808 - since you mentioned spending a lot of time on the Common Lisp tutorial for your friend - it would be awesome if you'd repurpose it as a general tutorial for people new to or interested in Common Lisp, maybe as YouTube videos?!
- kaveh808 5y agoThat's an interesting idea...
- kaveh808 5y agoBeen developing my software and updating the blog while I think about YouTube tutorials. Have to figure out how the screen recording works, whether I need to film myself, audio and editing, etc.
- pfortuny 5y agoI certainly second this. The entries on that blog are amazing, really. Thanks for them!
- ssfrr 5y agoReally enjoying the interleaved CL and flashbacks to Media Lab history
- kaveh808 5y agoThank you. More to come.
- ObscureScience 5y agoReminds me of Wings3d in that it's written in a less common language for this domain.
- kaveh808 5y agoInteresting that you bring up Wings3D. It was inspired by the polygon modeling tools in Symbolics's S-Geometry package.
- badsectoracula 5y agoAFAIK the inspiration was done in an indirect manner, S-Geometry -eventually- became Mirai which ended up at Izware which used the same representation (winged edge) for the 3D objects and perhaps algorithms to write Nendo but that one seemed to be in C++ (by checking out the executables in the demo[0] which is basically the only thing still available of all that nowadays) and Wings3D was really a clone of Nendo (made because the authors couldn't buy it - there was a post about it from around mid-2000s or so in a 3d modelling forum but i can't find it due to all the SEO google spam :-/). There are a few videos with Mirai on YouTube and if you compare it with Nendo you'll see that Wings3D is much closer to Nendo than Mirai. [0] https://archive.org/details/nendo-1-5-setup https://archive.org/details/nendo-1-5-setup