I fell down the rabbit hole of minimal LISP implementations again, and found this:

You get a LISP in ~1k lines of commented C code.

· · Web · 4 · 5 · 17

There's also an implementation that strips away the GC, making it even simpler!

it's approachable enough that I think I might try to hack in a Forth, as a proof of concept. In my computer music works, I find myself constantly thinking in both S-expressions and postfix notation.

For example, a sine modulating the frequency of another sine to make vibrato would look like this in postfix notation:

6 100 sine 440 add add 0.5 sine

You could turn the sine LFO into an s-expression like this:

(sine 6 100) 440 add 0.5 sine

Encapsulating the whole frequency input of the sine oscillator:

(add 440 (sine 6 100)) 0.5 sine

and, finally, the equivalent patch as an S-expression:

(sine (add 440 (sine 6 100)) 0.5)

@paul i think my rebol reader is about half that and there's no language interpreter yet :blobcatsweat:

@neauoire @paul my favourite is definitely the s-expression, but that’s probably because i’ve been spending a lot of time in clojure lately.

@emenel @paul the 1k lines lisp implementation is going to be pretty large in comparison to the equivalent RPN interpreter.

@emenel @neauoire In my experience: S expression is easier to read. RPN is more fun to type.

@paul @neauoire yes, i concur with this. long bits of RPN get really scrambled in my mind when i try to read them :)

@paul @emenel @neauoire this makes me think, perhaps an editor shortcut that transforms an RPN expr into an S-expr would be helpful here?

@neauoire For sure! This would be a much better abbreviation.

This top and bottom are both valid programs in two existing systems of mine. But not the stuff in between.

The reason why I use "add" is because "add" is actually an audio rate node, and "+" is a primitive arithmetic operation.

"sin" is pretty good, but it overloads the trig operation ("sine" is actually a table-lookup sine oscillator in my system).

@paul haha, yesterday and today i've put this in a (boring) project. (I couldn't resist the temptation to overengineer it at the last minute) :

@paul nice! I did one of those myself but I like how this one builds most of the fundamentals up out of macros. I've thought in the past about doing another one using a similar approach

Sign in to participate in the conversation

Welcome to, an instance for discussions around cultural freedom, experimental, new media art, net and computational culture, and things like that.

<svg xmlns="" id="hometownlogo" x="0px" y="0px" viewBox="25 40 50 20" width="100%" height="100%"><g><path d="M55.9,53.9H35.3c-0.7,0-1.3,0.6-1.3,1.3s0.6,1.3,1.3,1.3h20.6c0.7,0,1.3-0.6,1.3-1.3S56.6,53.9,55.9,53.9z"/><path d="M55.9,58.2H35.3c-0.7,0-1.3,0.6-1.3,1.3s0.6,1.3,1.3,1.3h20.6c0.7,0,1.3-0.6,1.3-1.3S56.6,58.2,55.9,58.2z"/><path d="M55.9,62.6H35.3c-0.7,0-1.3,0.6-1.3,1.3s0.6,1.3,1.3,1.3h20.6c0.7,0,1.3-0.6,1.3-1.3S56.6,62.6,55.9,62.6z"/><path d="M64.8,53.9c-0.7,0-1.3,0.6-1.3,1.3v8.8c0,0.7,0.6,1.3,1.3,1.3s1.3-0.6,1.3-1.3v-8.8C66,54.4,65.4,53.9,64.8,53.9z"/><path d="M60.4,53.9c-0.7,0-1.3,0.6-1.3,1.3v8.8c0,0.7,0.6,1.3,1.3,1.3s1.3-0.6,1.3-1.3v-8.8C61.6,54.4,61.1,53.9,60.4,53.9z"/><path d="M63.7,48.3c1.3-0.7,2-2.5,2-5.6c0-3.6-0.9-7.8-3.3-7.8s-3.3,4.2-3.3,7.8c0,3.1,0.7,4.9,2,5.6v2.4c0,0.7,0.6,1.3,1.3,1.3 s1.3-0.6,1.3-1.3V48.3z M62.4,37.8c0.4,0.8,0.8,2.5,0.8,4.9c0,2.5-0.5,3.4-0.8,3.4s-0.8-0.9-0.8-3.4C61.7,40.3,62.1,38.6,62.4,37.8 z"/><path d="M57,42.7c0-0.1-0.1-0.1-0.1-0.2l-3.2-4.1c-0.2-0.3-0.6-0.5-1-0.5h-1.6v-1.9c0-0.7-0.6-1.3-1.3-1.3s-1.3,0.6-1.3,1.3V38 h-3.9h-1.1h-5.2c-0.4,0-0.7,0.2-1,0.5l-3.2,4.1c0,0.1-0.1,0.1-0.1,0.2c0,0-0.1,0.1-0.1,0.1C34,43,34,43.2,34,43.3v7.4 c0,0.7,0.6,1.3,1.3,1.3h5.2h7.4h8c0.7,0,1.3-0.6,1.3-1.3v-7.4c0-0.2,0-0.3-0.1-0.4C57,42.8,57,42.8,57,42.7z M41.7,49.5h-5.2v-4.9 h10.2v4.9H41.7z M48.5,42.1l-1.2-1.6h4.8l1.2,1.6H48.5z M44.1,40.5l1.2,1.6h-7.5l1.2-1.6H44.1z M49.2,44.6h5.5v4.9h-5.5V44.6z"/></g></svg>