Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Liby: A Lisp interpreter in Ruby (github.com/tmountain)
20 points by tmountain on Oct 6, 2009 | hide | past | favorite | 11 comments


OT: What is the "platform sniffing" going in the the setup.rb file? The installer is trying to determine the Ruby version and the OS platform by using specific known-incompatible features and setting flags based on their success:

http://github.com/tmountain/Liby/blob/c784b187511750f27071e8...

This is how it's done on browsers, sure, outside javascript, it's best to add environment querying functionality and basic introspection to the language. Common Lisp has the following functions to do that, among others:

  Function LISP-IMPLEMENTATION-TYPE, LISP-IMPLEMENTATION-VERSION
  Function SHORT-SITE-NAME, LONG-SITE-NAME
  Function MACHINE-INSTANCE (hostname)
  Function MACHINE-TYPE   (processor architecture)
  Function MACHINE-VERSION  (processor version)
  Function SOFTWARE-TYPE, SOFTWARE-VERSION (OS name, and type)
  Function USER-HOMEDIR-PATHNAME 
Don't re-implement Lisp in Ruby. Clone and copy Lisp's features for your favorite language, so you don't have to emulate ./configure in a far richer environment; automake is poverty.

A few days ago I told the polite crowd in #ruby how I felt about the irb ruby shell. That too is lacking and there is tremendous room for improvement. Start by implementing value registers; in CL, * (star) contains the value of the last expression evaluated; (star)(star) the one before that, and (star)(star)(star) the one after the last. They come handy because you don't need to build complex binding LETs, and you don't have to pollute your current namespace creating global variables (naming something, on the spot when you're in the flow is really hard. And a convention is better than everyone inventing a trick)

I had to do (star) because HN ate my #\*s, Paul.


_ contains the value of the last expression evaluated in irb. I don't think there's a way to retrieve ones which were evaluated longer ago, although I might be wrong.

  >> "Expr"
  => "Expr"
  >> _
  => "Expr"



I'll have to admit I'm a big fan of James Coglan. Checkout his "Scheme in 15 minutes" screencast: http://blog.jcoglan.com/2009/05/19/talk-writing-a-language-i...


(<= a b c) doesn't seem to work.


Thanks for pointing that out. I'll get it fixed.


Yes, it's easy to implement small, elegant languages in larger ones. It's also easier to implement powerful meta-level tools in small, elegant languages.

(Though to be fair, the Common Lisp library is pretty burgeoning.)


what? why?


"may be useful for learning the basis of the Lisp language".


why not?


"only fools and geniuses insist on implementing their own languages, and you can never tell which is which until afterwards."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: