3 ms·
What I did was follow Paul Graham's Roots of Lisp[1]. He lays out in simple terms the basic operations, all I did was copy his examples into unit tests and then
by wolfgang42 10y ago
What I did was follow Paul Graham's Roots of Lisp[1]. He lays out in simple terms the basic operations, all I did was copy his examples into unit tests and then write code until the tests passed. I didn't even bother writing a parser, I just used JS expressions like this:
[natives.label, factorial,
[natives.lambda, [n], [natives.cond,
[ [natives.eq, n, 0], 1 ],
[ true, [natives.times, n, [factorial, [natives.plus, n, -1]]] ]
]]
]
It took me about 5 hours to get the whole think working from his paper, and I learned a lot in the process.