http://blog.fogus.me/2020/12/22/torilisp-an-ersatz-lisp-for-tiny-birds/ [fpjs] read [joc] read or learn more Send More Paramedics l l l Fogus' Thoughts on life, programming, and thinking [blm] c clj erl factor frink hs js org pure rkt qi Follow me on Twitter... # or RSS... # Run this blog in mobile 2020 2019 2018 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 ToriLisp - an ersatz LISP for tiny birds Dec 22, 2020 When deciding to work on a side-project three factors are needed to transition from fancy to application: goal, motivation, and time. Time is usually the biggest sticking point for me personally but with COVID most of what I may have spent my time on this year was cancelled. However, motivation was still a huge sticking point until I came across a couple of projects that helped propel me forward. First, I spent some time earlier this year combing over Mary Rose Cook's lovely Little Lisp interpreter code. Given what I knew about Mary's previous projects it was no surprise that the Little Lisp implementation was simple and elegant. However, what I wasn't prepared for was that hacking on the interpreter turned out to be straight-forward and addictive. However, it wasn't until I re-discovered William Taysom's old Scheme-like language Misp that I had a form for the interpreter in mind. At the time of William's original blog posts about Misp I was drawn to his passion and enjoyed the implementations of the language that he posted.^1 Around the same time I found Paul Graham's original Arc tutorial tut.txt and used it extensively to guide me in what to implement next.^2 All discussion about Arc aside, I definitely appreciate the clarity and layout of the Arc tutorial and found it a great outline for a little language. Finally, as some of you might know I dabbled in functional programming in JavaScript and even went so far as to create a couple of libraries pushing the fringe of fp in js; namely Lemonad and underscore-contrib. Some of the ideas in these libraries found their way into my own interpreter which ultimately pushed my code away from Misp, Little Lisp, and Arc into ...something else -- that something else I'm calling Tori Lisp -- an ersatz LISP for little birds. ToriLisp = Litle Lisp + Misp + tut.txt + Lemonad + underscore-contrib + a pinch of CLJ Here's a very small sample of the language: Niao > (let (x 3 y 4) (+ (* x 2) (* y 2))) ;;=> 14 (def map (l (fn list) (if (no list) list (cons (fn (first list)) (map fn (rest list)))))) Niao > (map (+ 10) '(1 2 3)) ;;=> [ 11, 12, 13 ] Niao > ({x y | (/ (+ x y) 2)} 2 4) ;;=> 3 Niao > (len "abc") ;;=> 3 Niao > (len {a | a}) ;;=> 1 Niao > (len +) ;;=> 2 Niao > (read "(push [1] 'Z)") ;;=> [ "'push", [ "'list", 1 ], [ "'quote", "'Z" ] ] Niao > (eval (read "(push [1] 'Z)")) ;;=> [ "'Z", 1 ] If I wanted to present a list of features then the following list would work:^3 * Functional * Immutable access to JavaScript arrays and hash-maps. * Function auto-currying * Function introspection * Bottoms-out at JavaScript structures and functions * ML-like Refs * Lightweight syntax for common language forms If you're interested in checking out the language then the ToriLisp Github repository has a quick start, test suite, and its own tut.txt. --------------------------------------------------------------------- 1. Though the implementations did not make the Internet Archive it seems. I reached out to Mr. Taysom years ago and he was kind enough to send me the code but I hesitate to share it publicly without his approval. - 2. Consider this a form of README-driven language development. - 3. Currently ToriLisp doesn't have macros though not because it would have been terribly difficult to add. Instead, I wanted to start with functional literals and auto-currying and see how far it could take me. I may add them at a later date but only time will tell. - Related posts: 1. On Lisp -> Clojure: ProloG (pt. 1) 2. Functional Shmunctional 3. On Lisp -> Clojure (Chapter 5) 4. On Lisp -> Clojure (chapter 2) 5. On Lisp -> Clojure (Chapter 3) No Comments, Comment or Ping Reply to "ToriLisp - an ersatz LISP for tiny birds" [ ] Name (required) [ ] Mail (required) [ ] Website [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] Submit [ ][Submit] Copyright (c) 2002 - 2011 by Fogus (license information) read about my policy on affiliate links Theme heavily influenced by Ryan Tomayko [ | Log in | top]