Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> The beauty of Scheme is that the full language only needs 5 keywords and 8 syntactic forms.

Is there a learning resource that covers exactly this for those wanting to write software in lisp in 2024?

As "first principle thinkers" in some ways all hackers crave for that "fundamental building blocks approach", a bit like wanting to know how we go from transistors to full computers and every step along the way. Most of us have made peace with accepting the many abstractions because we're slinging highly abstracted mostly python, and javascript code at startups.

So learning Lisp seems like a nice digestible point to start from along the continuum if indeed there's some eloquent way to learn: >only needs 5 keywords and 8 syntactic forms.

and then be off to the races, so to speak.



Various Scheme texts cover writing your own interpreter in more or less detail: Structure and Interpretation of Computer Programs (AKA SICP)*, the Little Schemer, Concrete Abstractions**. Norvig's Paradigms of AI Programming also contains a Scheme interpreter, though the text mainly focuses on Common Lisp. And finally I'd throw Exploring Programming Language Architecture in Perl*** in the mix as a more in-depth look at creating a Scheme interpreter.

The style of the Little/Seasoned/Reasoned Schemer is a little different from the other books I highlighted here, but various people have said they really like it, including Guy Steele, so they may be worth a look if the others don't really work for you.

*: <https://mitp-content-server.mit.edu/books/content/sectbyfn/b...>

**: <https://gustavus.edu/academics/departments/mathematics-compu...>

***: <https://www.billhails.net/Book/front.html>


You can try to implement your own Scheme like this,

"An Incremental Approach to Compiler Construction"

http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf

You will get you own compile to native code Scheme compiler, and then take it from there.

Don't care about performance, only the learning experience.


You could start with The Roots of Lisp, by pg: https://www.paulgraham.com/rootsoflisp.html

In the same vein, it is also fun to have a look at church-encoding in lambda calculus and to play with it in the language you choose.


I suppose 5 is better than lots but you can totally write a lisp with zero keywords.

I'm not sure what a syntactic form means here - dot as in dotted pair, nil, quote, quasiquote, parens? Having trouble coming up with 8 distinct syntactic things.

The basis set underlying lisp is something like the lambda calculus with optional delayed evaluation, a product type and some file I/O.

The optimal basis set for computation is either non-unique or not yet discovered as far as I can tell - different people arrive at different combinations.


> The optimal basis set for computation is either non-unique

If one adds a requirement of additively optimal program length as in [1], then Binary Lambda Calculus is a good candidate.

[1] https://gist.github.com/tromp/86b3184f852f65bfb814e3ab0987d8...


Second edition of Friedman's Essentials of Programming Languages is very good for this. A tough read, but very good. The second edition is written in Scheme, I think the third changed? (I can't recall the details but I know when I was hunting for reading it was recommended to stick to the second as I was specifically looking for Scheme).

https://www.librarything.com/work/347168


My way of learning about Lisp was based on first principles, after reading Norvigs blogpost many times and working through SICP. What helped is that I had just finished the nand2tetris book, which is very much a first principles speedrun of how a computer works.

So I built my own Lisp machine based on the nand2tetris architecture, with lisp instructions supported on the simulated chip level. I'm currently in the progress of doing a writeup of the project, you can see my attempts here if you are interested: https://deosjr.github.io/

I have an almost working version of a REPL running on the machine now, including garbage collection and parsing Lisp with Lisp and passing the output to an eval function written in assembly (the operating system, if you will).


Many years ago I wrote a simple programming language that would macro expand into lambda calculus statement that could then be compiled down to different sets of combinators - the simplest being just S & K, which are pretty fundamental given how simple they are. The fact that you can express things like recursion in the lambda calculate (see name of our hosts on this site) and therefore in combinators still amazes me.

Not the most efficient approach but it does work.

https://en.wikipedia.org/wiki/SKI_combinator_calculus


> expand into lambda calculus statement that could then be compiled down to different sets of combinators

This approach can be reasonably efficient for implementing Haskell, as shown in [1] and the much more concise [2].

[1] https://github.com/augustss/MicroHs

[2] https://crypto.stanford.edu/~blynn/compiler/


I find System Crafters[1] YouTube channel a great learning resource for everything Scheme, Lisp and Emacs

1. https://www.youtube.com/@SystemCrafters


SICP




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: