Lisp

Languages and libraries

lisp interpreter

SHOW HN2018

Lisp

Lisp with copying GC in 537 lines of C (plus Lisp 1.5 on top)

github.com

#lisp interpreter#copying garbage collector#lisp 1.5#minimal lisp in c

152points
34comments
#267of 2,155 in 2018
Top 13%of 2018 by points

How HN took it

MixedNo clear lean

6 positive, 2 neutral or asking, 0 mixed, 2 critical, out of 10 comments about the project. Thread score +0.19.

Execution: 3 for, 2 againstIdea: 2 for, 0 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Compact and clear implementation good for teaching

    From 3 comments
    • This is cool. I wrote a similar Lisp but got stuck debugging my copying GC. The interaction between the Lisp environment chain and the C stack is tricky. I prefer something like…
      blt on HN
    • Always good fun. Reminds me of XLISP which was my first exposure to Lisp. There's a lot to be said for small implementations that gets to the heart of the issues. Most great…
      FullyFunctional on HN
    • Sounds like a great pedagogical tool to me!
      sitkack on HN

Objections

  • Tail call optimization incomplete; runs out of memory on tail recursion

    From 2 comments
    • Things I see... 1. Mac OS apparently has a conflicting definition of "isnumber", as "__DARWIN_CTYPE_TOP_inline int isnumber(int _c)" in "/usr/include/ctype.h:323". Thanks, Mac…
      waterhouse on HN
    • Yeah the TCO is not complete, it allocates a call frame for each call regardless which is why it ran out of memory. It doesn’t use up the C call stack though, so you could in…
      krig on HN
  • Symbol interning uses linear search that scales poorly

    From 1 comment
    • I'm ok with minimalism, but interning strings in a simple array with linear search only scales to ~100 entries. a hash table can be written in 15 lines.
      rurban on HN
  • Does not build on macOS due to isnumber conflict

    From 1 comment
    • Things I see... 1. Mac OS apparently has a conflicting definition of "isnumber", as "__DARWIN_CTYPE_TOP_inline int isnumber(int _c)" in "/usr/include/ctype.h:323". Thanks, Mac…
      waterhouse on HN

Requests

  • Add integers as native type instead of strings

    From 1 comment
    • This is cool. I wrote a similar Lisp but got stuck debugging my copying GC. The interaction between the Lisp environment chain and the C stack is tricky. I prefer something like…
      blt on HN
  • Add a compiler or bytecode backend

    From 2 comments
    • Always good fun. Reminds me of XLISP which was my first exposure to Lisp. There's a lot to be said for small implementations that gets to the heart of the issues. Most great…
      FullyFunctional on HN
    • Thanks! Yeah, I am thinking that adding a similarly minimal compiler to this would be interesting as a next step. There is a previous effort in the ”old-version” directory which…
      krig on HN
  • Incremental Baker-style GC

    From 1 comment
    • Always good fun. Reminds me of XLISP which was my first exposure to Lisp. There's a lot to be said for small implementations that gets to the heart of the issues. Most great…
      FullyFunctional on HN

Questions

  • Is it lisp-1 or lisp-2, and is it Scheme?

    From 1 comment
    • Before I try, just always have a question - is it lisp-1 or lisp-2? Is it scheme/lisp? Given the lisp15.scm is a scm it seems to be underlying is a lisp 1.5 running under scheme.…
      kwccoin on HN

Alternatives named

  • Norvig's Python Lisp interpreter

    From 1 comment
    • This is cool. I wrote a similar Lisp but got stuck debugging my copying GC. The interaction between the Lisp environment chain and the C stack is tricky. I prefer something like…
      blt on HN
  • XLISP

    From 1 comment
    • Always good fun. Reminds me of XLISP which was my first exposure to Lisp. There's a lot to be said for small implementations that gets to the heart of the issues. Most great…
      FullyFunctional on HN
  • tiny-lisp by matp

    From 1 comment
    • Here's my own attempt at implementing a somewhat readable copying GC in C - https://github.com/matp/tiny-lisp/blob/master/tiny-lisp.c#L101
      mpirstitz on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/18215106)