Hacker News new | ask | show | jobs
Show HN: Draw L-Systems with Common Lisp (github.com)
72 points by BaraBatman 2157 days ago
2 comments

Hey! I recently started to learn LISP, and was looking for a way to try everything I've been learning, so I created this package (which can be installed with ql [0]) to draw fractals in a typical L-system form. You can see some of the cool fractals created in the examples of the project [1]

[0] (ql:quickload "cl-aristid")

[1] https://github.com/FdelMazo/cl-aristid/blob/master/examples/...

Nice job! The output looks really nice.

It was also clever to output to SVG: one of the trickiest for beginning CL can be to get a GL window to work... Is not that is super hard, I just find that it is an common failure vector (there's always something like a library that is missing or something like that).

Could be cool to include instructions to run something like live-server [1] (or some CL alternative) to get instant feedback on a browser window :-)

1: https://www.npmjs.com/package/live-server

This is awesome! Great work OP!

Always look forward to more Lispy ShowHNs. On another note, I am learning common lisp too, but I do not currently get how to make standalone projects. I tried quickproject but most of the time I remain confused. Is there a good explanation of this stuff online?

Currently I stick with (load "lisp-file"), with one main.lisp (I come from the C world) which calls everything else, but it is not really scalable nor really professional. Something like cargo or lein could work wonders!

Using explicit LOADs is fine, Lisp itself doesn't care. Though as you say a bit amateurish in the current year, but professionals did it extensively at one point. (Some probably still do.) Just like in Java, before maven plenty of shops were (some still are) fine with dumping their dependency jars in a thirdparty/ directory and doing everything with ant (or even shell scripts calling javac explicitly).

If you're willing to spend $26, I recommend this short ebook: https://www.darkchestnut.com/book-common-lisp-application-de... It basically gets you setup to create and deploy a production binary with minimal pain while meeting several professional-level expectations, though of course there's lots of tweaking you can do later on and there are always professional differences of opinion for substitutions... The gist of the book's project setup though is that you use ASDF to define your system (similar to a clojure defproject) and its bundled UIOP library for anything interfacing with the OS, qlot to pin versions of your dependencies, tell quicklisp about your local system so while developing you can make wide changes and just reload the system through slime with ql itself, use buildapp to simplify building exes, and use the venerable Make as a wrapper to do builds/cleans/deploys/tests in one step.

Apart from that and the resources others linked, read the ASDF manual: https://common-lisp.net/project/asdf/#documentation That home page also points to other useful things to know about...

Last piece of generic advice... It's often best to read primary sources. Make CLHS your bible, Steele's cltl2 is also great.

Thank you so much for the detailed response!
This page gives a nice overview: https://lispcookbook.github.io/cl-cookbook/getting-started.h...

Basically Quicklisp is your CL package manager, and ASDF is your makefile.

The Common Lisp Cookbook is an excellent starting point for learning more about the Lisp ecosystem: https://lispcookbook.github.io/cl-cookbook/

Another great introduction to Lisp is this blog post by Steve Losh: https://stevelosh.com/blog/2018/08/a-road-to-common-lisp/