4 ms·
No more "minimal early Lisps", pulleezz
- fogus 16y agoHere are a few of the culprits: http://www.paulgraham.com/rootsoflisp.html http://www.paulgraham.com/rootsoflisp.html http://www.fogus.me/fun/lithp/ http://www.fogus.me/fun/lithp/ http://nakkaya.com/2010/08/24/a-micro-manual-for-lisp-implemented-in-c/ http://nakkaya.com/2010/08/24/a-micro-manual-for-lisp-implem... http://www.zogotounga.net/comp/squeak/lispkit.htm http://www.zogotounga.net/comp/squeak/lispkit.htm Curse them all.
- stcredzero 16y agoThere's Broccoli, which is a conventional scripting language project that just borrows Lisp syntax out of laziness. http://news.ycombinator.com/item?id=203658 http://news.ycombinator.com/item?id=203658
- zephjc 16y ago"I personally have a difficult time wrapping my head around ideas like, functional, and closures, and lambda, in the abstract, so this is my way (not there yet BTW) of really wrapping my head around these ideas." - fogus He went from that to writing a book about a Lisp (Clojure) in just 943 days (~ 2.5 years) :)
- fogus 16y agoLOL! It's so funny reading that now; what a horrible little language. At the time I was neck deep in Java and a few years removed from my grad school studies. That project helped to refresh some of my dormant knowledge and excitement for Lispiness. I guess like riding a bike, you never forget closures. :p
- fogus 16y agoInterestingly, I threw that language away in favor of Clojure.
- wglb 16y agoAnd there is this one: http://waspvm.blogspot.com/ http://waspvm.blogspot.com/
- noahlt 16y agoDon't forget http://norvig.com/lispy.html http://norvig.com/lispy.html
- smithbits 16y ago"Surely you're not learning much by repeating JMC's flawed Ur-Lisp from 1959." No. Implementing an ur-lisp teaches you all kinds of things if you've never implemented a programming language before. It's a solid bite-sized project that's harming no one. Think I'll go write another one, maybe in Haskell this time.
- stcredzero 16y agoHow about Javascript?
- larrik 16y agoI agree. Simply writing my own scripting language once taught me a lot more than I would have expected. Now I use Lua, though.
- silentbicycle 16y agoImplementing Forth will also teach you a lot of (different) things, and can be done relatively quickly.
- Semiapies 16y agoSo do both.
- rwmj 16y agoAnd implement something that compiles down to native code too.
- swaits 16y agoWhat if it just happens to be fun? Do whatever you want!
- poink 16y agoOh boy! I hope he takes people to task for writing Hello World programs next.
- brlewis 16y agoI hope so too. I want to know the minimum standard for a "Hello World" in 2010.
- ihodes 16y agoIn the comments the author noted that he'd "never met a Lisp that [he] liked". Maybe that's why he doesn't see the value in learning something from writing a basic Lisp yourself.
- anatoly 16y agoI don't understand what he means by "semantic concepts". Anyone?
- primodemus 16y agofrom the r6rs spec: http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-8.html#node_chap_5 http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-8.html#node_cha...
- mechanical_fish 16y agoIt's this friendly, open attitude to new young programmers that has made Lisp as popular as it is today. I can't wait to see this person's algebra textbook. "Integral calculus is so old and boring, puleezz. Wake me up when you've rediscovered quaternions." And people wonder how PHP can be so popular. I could spend all day enumerating PHP's faults, but when people who have never written an X before build an X in PHP, the PHP community welcomes them with smiles, not sneers. I wish, I really do, that one percent of one percent of the world's programmers had actually implemented a simple Lisp in Lisp, let alone reached the point where such a thing seemed boring. But lecturing us on our lameness is not going to help.
- brlewis 16y agoComment by the author of the article: @fogus: Hm, lucky you, I've never met a Lisp I did like ;) Don't measure a community by its detractors. Further, people don't wonder why PHP is popular. Its popularity originated in ISP-friendliness, and has grown since then through network effects. EDIT: People are still voting up the parent comment, so I probably wasn't clear enough: the parent comment is totally wrong, starting with the words "It's this". The attitude of someone who does not like Lisp is not even a single datapoint, much less evidence, as to how the Lisp community treats newbies.
- Semiapies 16y agoHe may be a detractor, but the attitude is similar.
- mechanical_fish 16y ago"Totally wrong"? I apologize for opening with some black humor that has obviously touched a nerve, but once you delete my hyperbolic opening sentence I'll defend the rest of the sentences. I guess I didn't realize that I needed to explictly call out the existence of friendly, helpful, newb-friendly Lisp teachers on Paul Graham's Hacker News as implemented in Arc -- it is easy to forget that not everybody is steeped in the local culture -- but let me now be more explicit: There are plenty of people who are happy to help teach newbs all about higher-order programming by helping them implement their very own toy version of Lisp, and by taking joy in the results. Thank god for those people.
- yan 16y agoWow. Summary: "I only liked implementing Lisps when they were on vinyl.' I don't understand smugness when it comes to other peoples' small projects. No one sets out to implement CLv2, just further their own knowledge via a smallish side-project.
- lukeschlather 16y agoIt's the inverse of that. He's insisting we should implement Lisps in digital, because vinyl is useless.
- Semiapies 16y ago"And some of these [toy, throwaway] languages then become successful, and fuck up my life, because I may be forced to use them to access some library or script some program." That thing you just stepped in? That's a big pile of bullshit.
- flogic 16y agoEspecially considering there are a lot of worse things to write scripts in than some ghetto lisp. Most people would consider Emacs lisp a bit on the ghetto side, but it's still quite effective. I'm not a big Lisp fan but I'll take a ghetto lisp over a number of other ghetto languages any day.
- omouse 16y agoIt's fine and fun to make a minimal early Lisp, just remember you don't have to release it to the public. Make it open-source, but don't post it on the web or just give it out to a few friends to try out or whatever.
- philwelch 16y ago"Hide your shame, young hacker! No one wants to see your lisp!"
- blacksmythe 16y ago>> consider writing a Haskell, not a Lisp. Has anyone written a Haskell (or subset) as a hobby project? I would think it would be much harder than writing a simple Lisp, which seems to be designed so that simple versions can be written almost recurvisely, where more advanced functions are decomposed into a few primatives.
- theFco 16y agoI wrote a small compiler for a 'haskell' called HNH with type inference that generates C code, with a small runtime including GC. Everything is done very naively, but it's a hugely interesting excercise. You can find it in https://github.com/fferreira/hnh https://github.com/fferreira/hnh
- pmarin 16y agoI am just wondering how this "article" got 42 points...
- rayiner 16y agoPeople write minimal Lisps because they're easy while being elucidating. You can describe a compiler for a more-than-minimal Lisp in a forum post. 1) Specify representations for: integers, strings, symbols, and cons-es; specify a data structure for the symbol table and define INTERN properly. 2) Implement the reader, cribbing heavily from CLHS 2.1.4, 2.2. Set up constituent, whitespace, and terminating character classes, and implement reader macros for at least quote, double quote, and left/right parens. 3) Specify a representation for the environment, which will map symbols to offsets of variables on the stack frame; have a stack of these objects. 4) Figure out what special operators to handle. You can get away with just: lambda, progn, if, quote, let. 5) Starting from each top level form, walk the code recursively. Each element you encounter will either be: a) a top-level definition b) a single symbol variable reference c) a list with a symbol at its head which is a special form d) a list with a symbol at its head which is a function call As you walk the code, push a new environment onto the stack for each lambda and let you come across, which you pop off when you're done walking the corresponding body (but make sure you save it somewhere). 5.1) In one pass, collect information on closed-over variables. Walk the code looking for variables which are referenced (5b) but are not present in the environment. In that case search up the stack. If you find it in a parent environment, it's a closed-over variable. If you don't find it at all, it's a global variable. 5.2) Use the environment structures you just collected to assign local variables to stack slots. Figure out a closure representation (use a code pointer followed by an array of closed-over variables). Use the info you collected in (5.1) to assign variables to stack slots and closure variable references to closure variable slots. 5.3) In a second pass, generate code. When you reach: a) A TLD, emit a call to the runtime to associate a global name with a lambda b) A variable reference, emit code to either load the value from the stack slot noted in your environment structure, or from the appropriate closure slot, or emit a call to the runtime to look up a global value. c) A special form: generate function prologues/epilogs when you reach a lambda form, use labels and jumps to implement 'if', and use whatever data facilities your assembler has to handle quote-ed literals. When you reach a nested lambda, emit its code as a separate function, then at the point where it is used as a value in the parent function call a closure creation function providing it with the address of the generated code plus the values of all closed-over variables. d) A function call, emit a call to the runtime to look up the global value, then evaluate each of the arguments left to right, pushing them onto the stack. Then, jump to the body of the function. 6) Implement the runtime functions for cons handling, the global symbol table, and closure creation. Extend as you see fit to include mutable variables, etc.