Adventures in learning Lisp, as an artist, not an academic
I've had it in my mind to learn Lisp - it seems odd compared to other languages, lots of far out things are easily possible, like transpiling to other languages: C, python, javascript, webassembly, etc. And there are so many Lisps! And implementations!
Anyway, this article is my collected notes on my journey so far. I'm not really a programmer, just an avant garde artist, so maybe this will become an artwork.
circa april 11th:
Started by reading wikipedia, I guess Common Lisp is the generic standard dialect for normal humans, so the only choice is implementation. SBCL seems to be the main one, but ECL seems interesting, compilable with any C compiler? In reading the docs, I guess ECL is sort of meant to be tied into an existing C project, not quite the generic thing I was hoping for.
The SBCL port for FreeBSD is apparently not for ARM systems.. the makefile specifies only amd64 and i386 :^) same story with clisp and Clozure CL.. the joys of trying to do this on a Raspberry Pi 4 with FreeBSD.
Not to be discouraged, I found a binary version of SBCL 2.2.0, and went about installing it into /opt
short digression, I learned that $PATH is set in /etc/login.conf in FreeBSD, and it requires a command to be ran after changes.
Typing 'sbcl' in a terminal works! Discovered the book Practical Common Lisp while waiting on compilation of the latest sbcl (2.3.3).
At this point I'm trying to spit out a hello world binary, but it's like 30 megabytes? I'm not understanding: how do I get just a standalone binary, and not deal with this REPL nonsense, why isn't it as simple as doing a thing in C? Apparently the entire philosophy of development is opposed to this:
https://stevelosh.com/blog/2018/08/a-road-to-common-lisp/#s16-lisp-as-a-system
This seems very strange to my brain, how the hell does anyone get a shippable binary?
may 15th:
Forget all of that, what about Scheme? Seems much simpler than the likes of Common Lisp, the spec being so short.
may 21st:
Ok, Scheme is the way to go, discovered Chicken Scheme, which has a simple tool for compilation
to a binary blob, by way of the system C compiler, without including the whole entire interpreter etc like
SBCL wanted to do (is everyone using SBCL essentially shipping little VM images?). Now I can begin figuring
out a dev environment (does it really have to be emacs??) and the funky s-expression syntax; this book seems
good:
https://docs.scheme.org/tyscheme/
hello world achieved:
(begin
(display "hello world")
(newline))
may 22nd:
Attempting to go through the cryptopals exercises in this, its going to be a pain.. I need base64 stuff, but Scheme doesn't include that, so now the adventure is to figure that out.
june 6th:
Cryptopals is too much, I've been trying the project Euler things instead, but it's also a pain.. why does Scheme not have a sane way of doing loops?! I will break my rule of staying "clean" and use a chicken module that adds in some syntax for loops. I also need SRFI-158: generators and accumulators; this will make things half sane.
june 11th:
made it through Euler problem 3, feeling like I'm getting a handle on the basics of Scheme. Problem 3 turned out to be completely trivial, all I needed to do was import the Chicken module that implements Racket's math functions, so my code is hardly anything:
(import math.number-theory.base) ;math module from racket
(display (prime-divisors 600851475143))
conclusion:
This has been fun, rotating my brain to think of things in a different way. I'm not sure what projects I may do in this yet, other than continuing the Euler problems (and maybe the cryptopals things, if I get a grip..). The funky syntax has not really been an issue thus far, I've found, which is a bit surprising considering my previous experience is mostly Java or Python; did I just discover that I'm a functional programmer and not an object-oriented one? I have had trouble before reasoning about objects.. can't keep it all in my brain, even without any inheritence going on.
Anyway, more to come, hopefully something artistic

