TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Lisp in 32 lines of Ruby

194 pointsby johndcookover 13 years ago

18 comments

jlongsterover 13 years ago
I've just started working on full-featured Lisp in javascript over the past few weeks: <a href="https://github.com/jlongster/outlet" rel="nofollow">https://github.com/jlongster/outlet</a><p>It will compile to js and lua, and I'm focusing on writing games with it. I can attest that writing a Lisp compiler is really fun and shockingly simple in some places.<p>Current features I'm working on: <a href="http://jlongster.com/2012/01/16/outlet-gets-a-personality.html" rel="nofollow">http://jlongster.com/2012/01/16/outlet-gets-a-personality.ht...</a>
评论 #3511788 未加载
评论 #3512276 未加载
评论 #3511420 未加载
pjscottover 13 years ago
This "lisp in x lines of y" tradition started with the original Lisp paper back in 1960, which defined lisp in a few lines of lisp. Which, when you think about it, is an extraordinarily lispy thing to do.
评论 #3512288 未加载
nick_aover 13 years ago
Hey guys<p>This seems like it would be perfect stuff for an educational lightning talk<p>If any of you are in the SF Bay Area, please consider doing a ~5 min presentation on your lisp-in-x implementation at the lisp meetup "revival" this saturday at the blackbox mansion in Atherton<p>...free beer... ;-)<p><a href="http://www.meetup.com/balisp/events/48872022/" rel="nofollow">http://www.meetup.com/balisp/events/48872022/</a> <a href="http://balisp.org/" rel="nofollow">http://balisp.org/</a>
lloekiover 13 years ago
A similar endeavor in Python: <a href="http://www.brool.com/index.php/the-tiniest-lisp-in-python" rel="nofollow">http://www.brool.com/index.php/the-tiniest-lisp-in-python</a><p>I find it quite entertaining to see how specific language features allow for differing patterns. It is much more apparent with such Lisp implementations than with your typical <i>Hello, World</i> app or hidden by some library or framework.
评论 #3512349 未加载
judofyrover 13 years ago
See also: Heist, a feature-rich implementation of Scheme in Ruby: <a href="https://github.com/jcoglan/heist" rel="nofollow">https://github.com/jcoglan/heist</a>
sinamdarover 13 years ago
Shameless Self Promotion. Here are two version of the LISP interpreter in JavaScript that I wrote:<p>1. Direct port of Peter Norvig's version in Python:<p><a href="https://bitbucket.org/sainamdar/lisp2js/" rel="nofollow">https://bitbucket.org/sainamdar/lisp2js/</a><p>2. Separate Syntactic Analysis from Execution:<p><a href="https://bitbucket.org/sainamdar/lisp2js2/" rel="nofollow">https://bitbucket.org/sainamdar/lisp2js2/</a>
mrspeakerover 13 years ago
I think that's a testament to the awesomeness of Lisp, not of Ruby ;)
评论 #3511586 未加载
评论 #3512370 未加载
lisperover 13 years ago
Lisp (including full lexical closures) in 50 lines of Python:<p><a href="http://www.flownet.com/ron/lisp/l.py" rel="nofollow">http://www.flownet.com/ron/lisp/l.py</a>
eschulteover 13 years ago
Cute, but from like 28 [1] it looks like there is no macro support, so this isn't a lisp but is rather a way to write a ruby expression in a ruby array.<p>[1] <a href="https://github.com/fogus/ulithp/blob/master/lithp.rb#L28" rel="nofollow">https://github.com/fogus/ulithp/blob/master/lithp.rb#L28</a>
评论 #3511833 未加载
gaiusover 13 years ago
32 lines of Ruby and a hundred thousand lines of C, let's not forget. Anyone can write any short program in a DSL, that is not represenative of the true complexity of it.
评论 #3517028 未加载
nodemakerover 13 years ago
Wow...for me learning LISP just earned itself priority-High status!
lignuistover 13 years ago
It seems funny to me, that it needs most probably more lines to write a good lisp tutorial for beginners, than a lisp implementation. Lisps beauty lies in its simplicity.
ben0x539over 13 years ago
Next up, lisp in 1 line of common lisp
评论 #3511478 未加载
pabloPXLover 13 years ago
I translated it to js -&#62; <a href="https://gist.github.com/1679611" rel="nofollow">https://gist.github.com/1679611</a> Earned 1 line, and packed it with a cheap implementation of zip :3
ct_elegansover 13 years ago
I personally, have been waiting centuries for our robotic overlords to improve the runtime performance of lisp. Now I can wait some more!
评论 #3511990 未加载
评论 #3511593 未加载
kruhftover 13 years ago
A real lisp: <a href="http://sbcl.org" rel="nofollow">http://sbcl.org</a>
marijnover 13 years ago
He seems to have forgotten lambda, without which you can't really write anything more interesting than the examples that are given.
评论 #3511490 未加载
评论 #3511492 未加载
skrebbelover 13 years ago
<p><pre><code> :if =&#62; lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) }, </code></pre> Seriously, any production code like that (very long line, cryptic variable names to make it fit better on said line) would get nasty review comments here.<p>Why not put the whole thing a single line and have an even prettier page title?