Lisp in a Weekend
github.com
github.com
I'd be interested in reading more about this. For example, how was that set of primitives chosen? How does the author know that the set of primitives is sufficient?
A couple relevant (and interesting) links:
What is the "minimal" set of primitives needed for a Lisp interpreter? https://www.cs.cmu.edu/Groups/AI/html/faqs/lang/lisp/part1/f...
What is the smallest definition of Lisp? https://www.reddit.com/r/lisp/comments/aklz0x/what_is_the_sm...
This does give me an idea to do it in even less, though. I'll have to spend a weekend on it.
It's also worth noting that the 1.5 metacircular interpreter is incomplete: https://github.com/kragen/stoneknifeforth#why--to-know-what-...
It went a little too minimal in having no comments.
Steve Yegge said there were seven (or five):
McCarthy had five.
On an x86 architecture - you can do it with one.
https://stackoverflow.com/questions/3482389/how-many-primiti...
https://en.wikipedia.org/wiki/One-instruction_set_computer#M...
To be able to define recursive functions, you'll also need cond, lambda, setq (or define), quote, and function. That's five special forms.
Then you have to write read, eval, apply, and print in your implementation language. That gives you a minimal interpreter. These four functions aren't primitives, but you have to write them and you might as well expose them to the user. Eval and apply call a few other functions which are generally useful, such as assoc, evlis and pairlis.
This excludes arithmetic functions and a whole lot of other stuff you'd need for your interpreter to be useful.
also do you know other books of the same kind ?
Maybe, I'll think about it.
Besides that, the history of Lisps is fascinating, specially Lisp machines.
I can do it but I can just never quite make the other languages fit how I want to think about the problems.
I think one major barrier is that nearly every language I have to use is lumbered with truly horrible data handling with the pervasive OO model that is so bad. I've used CLOS too much to never look at OO the same again.
And then if I'd rather just think of things as name/value collections, Clojure is just so easy.
Javascript was my first intro to the liberation dynamic types and functional programming can bring when I built a project in Vue. I kinda loved it.
I started writing code in emacs lisp to help me write and navigate xml and it's been wonderful. now im deciding on whether to use Common Lisp or guile to build some projects. I'm sold.
Even using js to do cl like is hard.