Re:What else are we getting wrong about programming languages?
by err4nt on Sunday October 30, 2016 @05:53PM
(#12832588)
Hey thanks for taking the time to write this out. I'm new to programming and learning JavaScript, and what you said about exposing the AST and writing new syntaxes for the same language is really intriguing.
I try to learn about the history of computer science and I try to understand where languages have come from - and one so far I haven't dabbled with any of the Lisp languages at all. If I was a JS learner curious about Lisp - what's the easiest way for me to get started with some experiments?
Re:What else are we getting wrong about programming languages?
by lisper on Sunday October 30, 2016 @07:04PM
(#12833055)
I started working on a book a while back targeted specifically towards people who already know a little about programming:
https://github.com/rongarret/BWFP
It's nowhere near complete but I'm working on chapter 3 now.
Re:What else are we getting wrong about programming languages?
by jbpetersen on Sunday October 30, 2016 @07:26PM
(#12833147)
Try checking out https://github.com/maryrosecook/littlelisp. It's a relatively very simple Lisp interpreter written in JS.
http://languagelog.ldc.upenn.edu/myl/ldc/llog/jmc.pdf is another great resource for being introduced to Lisp.
Re:What else are we getting wrong about programming languages?
by didibus on Sunday October 30, 2016 @08:30PM
(#12833446)
Maybe ClojureScript.
Re:What else are we getting wrong about programming languages?
by dnautics on Sunday October 30, 2016 @06:55PM
(#12832995)
Julia has AST as a first class object, but I think it does this by secretly running lisp behind the scenes.
A single language can support multiple syntaxes if the AST is exposed as a first-class construct. This makes it easy to write new syntactic front-ends. Unfortunately, the only language to date that supports this idea is Lisp, which means that this incredibly powerful idea is conflated in most people's minds with lots of irritating silly parentheses. (One of the reasons for this conflation is that once you start adopting this mindset the parens become a lot less silly and irritating, but that's another story.)
I'm currently working on cryptography code, where algebraic syntax is very convenient. Here's an excerpt from some code I'm currently working on:
Notice that it looks like Lisp (and it is Lisp) but there's infix code seamlessly embedded. Moreover, the MODP construct automatically converts everything to modular arithmetic operations, so, for example, x/y doesn't actually divide but instead expands into (* x (modular-inverse y p)). But when I code, all I have to do is copy the mathematical formulas more or less verbatim and my compiler takes care of expanding everything out into calculations that use Montgomery reduction or whatever optimizations I want to provide. This approach also has the advantage that I can test the correctness of my protocols completely independently of the correctness of my optimizations.