

Liby: A Lisp interpreter in Ruby - tmountain
http://github.com/tmountain/Liby

======
mahmud
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...](http://github.com/tmountain/Liby/blob/c784b187511750f27071e8614ed9e6eb37cd9797/setup.rb)

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.

~~~
ionfish
_ 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"

------
ionfish
See also: Heist, Bus Scheme.

<http://github.com/jcoglan/heist>

<http://github.com/technomancy/bus-scheme>

~~~
judofyr
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...](http://blog.jcoglan.com/2009/05/19/talk-writing-a-language-
in-15-minutes/)

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

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

------
stcredzero
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.)

------
nestlequ1k
what? why?

~~~
raganwald
why not?

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

