[{"data":1,"prerenderedAt":264},["ShallowReactive",2],{"project-18215106":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":27,"sentiment":28,"stance_mix":29,"scored_comments":33,"aspects":34,"strip":39,"post_text":42,"what":43,"said":82,"maker_in_thread":160,"shape":168,"grid":173,"attempts":227,"same_week":228,"maker_shows":41,"maker_hidden":257,"reader_version":258,"card":259},"18215106","Lisp","Lisp with copying GC in 537 lines of C (plus Lisp 1.5 on top)","title","Show HN: Lisp with copying GC in 537 lines of C (plus Lisp 1.5 on top)","https:\u002F\u002Fgithub.com\u002Fkrig\u002FLISP","github.com","krig",1539548676,2018,152,34,267,2155,13,"notable","languages","lisp interpreter","cli",[21,24,25,26],"copying garbage collector","lisp 1.5","minimal lisp in c","mixed",0.19,{"positive":30,"neutral":31,"mixed":32,"critical":31},6,2,0,10,{"execution":35,"idea":37,"design":38},{"positive":36,"critical":31},3,{"positive":31,"critical":32},{"positive":32,"critical":32},[40,32,32,32,32,32,32,40,32,40,32,41,32,36,36,32,41,40,40,32,32,32,32,40,32],5,1,null,{"problem":44,"audience":54,"pricing":42,"motivation":62,"time_to_build":42,"stack":67,"openness":79,"stage":80,"team_size":81},{"value":45,"source":46,"evidence":47},"Teaching how a Lisp interpreter and its garbage collector work in a small codebase","maker",[48,51],{"id":49,"by":11,"text":50},"18217936","Cool, that's an interesting solution! I tried hard to keep the GC implementation as straight-forward as possible, as a teaching aid, but I'll admit that debugging the GC was a…",{"id":52,"by":11,"text":53},"18217659","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…",{"value":55,"source":56,"evidence":57},"People learning about interpreters and garbage collection","inferred",[58,59],{"id":49,"by":11,"text":50},{"id":60,"by":11,"text":61},"18217664","I felt the same way about Norvigs version which was one reason to do this. I feel like the recursive lisp interpreter-on-an-interpreter thing is not as clear when so much of the…",{"value":63,"source":46,"evidence":64},"Make a minimal yet complete Lisp with GC as a teaching aid",[65,66],{"id":52,"by":11,"text":53},{"id":49,"by":11,"text":50},[68,73],{"value":69,"source":46,"evidence":70},"C",[71],{"id":72},"post",{"value":74,"source":46,"evidence":75},"Scheme",[76],{"id":77,"by":11,"text":78},"18217577","The base language interpreter written in C is a lisp-1, and it’s not even close to a full scheme implementation but it is a subset of scheme. The LISP 1.5 interpreter runs on top…","open_source","launched","unknown",{"praise":83,"objections":100,"requests":122,"questions":136,"alternatives":144},[84],{"value":85,"source":86,"evidence":87},"Compact and clear implementation good for teaching","commenter",[88,92,96],{"id":89,"by":90,"text":91},"18215921","blt","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…",{"id":93,"by":94,"text":95},"18217448","FullyFunctional","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…",{"id":97,"by":98,"text":99},"18216027","sitkack","Sounds like a great pedagogical tool to me!",[101,111,118],{"value":102,"source":86,"evidence":103},"Tail call optimization incomplete; runs out of memory on tail recursion",[104,108],{"id":105,"by":106,"text":107},"18217568","waterhouse","Things I see... 1. Mac OS apparently has a conflicting definition of \"isnumber\", as \"__DARWIN_CTYPE_TOP_inline int isnumber(int _c)\" in \"\u002Fusr\u002Finclude\u002Fctype.h:323\". Thanks, Mac…",{"id":109,"by":11,"text":110},"18217673","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…",{"value":112,"source":86,"evidence":113},"Symbol interning uses linear search that scales poorly",[114],{"id":115,"by":116,"text":117},"18215507","rurban","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.",{"value":119,"source":86,"evidence":120},"Does not build on macOS due to isnumber conflict",[121],{"id":105,"by":106,"text":107},[123,127,132],{"value":124,"source":86,"evidence":125},"Add integers as native type instead of strings",[126],{"id":89,"by":90,"text":91},{"value":128,"source":86,"evidence":129},"Add a compiler or bytecode backend",[130,131],{"id":93,"by":94,"text":95},{"id":52,"by":11,"text":53},{"value":133,"source":86,"evidence":134},"Incremental Baker-style GC",[135],{"id":93,"by":94,"text":95},[137],{"value":138,"source":86,"evidence":139},"Is it lisp-1 or lisp-2, and is it Scheme?",[140],{"id":141,"by":142,"text":143},"18217079","kwccoin","Before I try, just always have a question - is it lisp-1 or lisp-2? Is it scheme\u002Flisp? Given the lisp15.scm is a scm it seems to be underlying is a lisp 1.5 running under scheme.…",[145,149,153],{"value":146,"source":86,"evidence":147},"Norvig's Python Lisp interpreter",[148],{"id":89,"by":90,"text":91},{"value":150,"source":86,"evidence":151},"XLISP",[152],{"id":93,"by":94,"text":95},{"value":154,"source":86,"evidence":155},"tiny-lisp by matp",[156],{"id":157,"by":158,"text":159},"18216469","mpirstitz","Here's my own attempt at implementing a somewhat readable copying GC in C - https:\u002F\u002Fgithub.com\u002Fmatp\u002Ftiny-lisp\u002Fblob\u002Fmaster\u002Ftiny-lisp.c#L101",{"comments":161,"answered":31,"key":162},8,[163,164,165],{"id":49,"text":50},{"id":60,"text":61},{"id":166,"text":167},"18218560","That is certainly a good point. The problem I felt with dropping below malloc is that the code becomes very platform-dependent.",{"commenters":169,"max_depth":170,"maker_replies":161,"first_comment_mins":171,"lifespan_hours":172},15,4,69,35,[174,176,178,179,181,184,186,188,189,191,193,197,199,201,202,205,206,207,210,211,214,217,219,221,225],[89,32,40,175,90,32],"project\u002Fpositive\u002Fexecution",[157,32,32,177,158,32],"commenter\u002Fneutral\u002Fnone",[49,32,32,177,11,41],[60,32,32,180,11,41],"project\u002Fpositive\u002Fidea",[182,32,32,177,183,32],"18218314","slaymaker1907",[166,32,32,185,11,41],"project\u002Fneutral\u002Fdesign",[187,32,32,177,90,32],"18222495",[93,41,40,180,94,32],[52,41,32,190,11,41],"project\u002Fneutral\u002Fidea",[192,41,40,175,94,32],"18227337",[194,31,32,195,196,32],"18218763","other\u002Fneutral\u002Fnone","daef",[105,36,41,198,106,32],"project\u002Fcritical\u002Fexecution",[109,36,32,200,11,41],"project\u002Fneutral\u002Fexecution",[141,170,36,185,142,32],[203,170,36,185,204,32],"18217444","hawkice",[77,170,32,185,11,41],[115,40,41,198,116,32],[208,40,40,175,209,32],"18215890","UncleEntity",[97,40,40,180,98,32],[212,40,32,177,213,32],"18216670","shawn",[215,40,32,177,216,32],"18218166","pg314",[218,40,32,177,213,32],"18219155",[220,40,32,175,11,41],"18217587",[222,30,40,223,224,32],"18215705","maker\u002Fpositive\u002Fnone","brian_herman",[226,30,32,223,11,41],"18217617",[],[229,234,239,244,248,253],{"id":230,"name":231,"points":232,"category":233},"18219960","Polar",382,"productivity",{"id":235,"name":236,"points":237,"category":238},"18193264","Muze",361,"dev_tools",{"id":240,"name":241,"points":242,"category":243},"18211251","TensorFlow-Course",327,"learning_science",{"id":245,"name":246,"points":247,"category":243},"18219296","Physically Based Rendering",297,{"id":249,"name":250,"points":251,"category":252},"18240755","Coffee Chat",182,"consumer_social",{"id":254,"name":255,"points":256,"category":238},"18236125","Mole",142,false,"v2",{"id":260,"name":5,"line":6,"ai":257,"cat":20,"year":13,"points":14,"comments":15,"rec":27,"s":28,"top":18,"kw":261,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":262,"url":9,"mix":263,"praise":85,"objection":102,"sub":21},18215106,[21,24,25,26],"5000000505010330155000050",[30,31,32,31],1794036570470]