Live data from Hacker News

μLithp - a Lisp in 27 lines of Ruby

fogus.github.com

21–30 of 104 posts

Re: μLithp - a Lisp in 27 lines of Ruby

#21
post #5
post #3

I think this is a neat project and a nice demonstration of how Lisp-influenced Ruby is. However, whenever people post "Lisp in Ruby" stories, I always hope that it'll be a "Clojure in Ruby" implementation. I am surprised no-one has done it yet.

Apart from using the JVM, what is the advantage of Clojure over other Lisp dialects?

I am mostly familiar with Clojure as opposed to CL (have read a bit of Practical Common Lisp) or Scheme (have read a decent chunk of SICP), but there are some pieces here and there.

Clojure is immutable by default, which is a pretty big difference AIUI. It also has a pretty strong emphasis on concurrency, including a bunch of primitives for such. It uses STM.

A bunch of data structures are first class, like vectors, maps, and sets. There are literals for each of them, and you can use maps and sets as functions. You can also use keywords as functions against maps to e.g. retrieve the :name value from a list of maps:

    user=> (map :name [{:name "foo"} {:name "bar"}])
    ("foo" "bar")
Lambda literals are nice:

    user=> (map #(* 2 (inc %)) [1 2 3])
    (4 6 8)
They can take multiple args (e.g. %1 %2) instead of just %.

Threading macros are somewhat closer to Haskell's syntactically straightforward function composition:

    user=> (->> [1 2 3] ;; this'll be the last arg passed to each fn below
    #_=>   (map #(* 2 %))
    #_=>   (map inc))
    (3 5 7)
I'm sure there's more. Maybe a more experienced Lisper can chime in.

Re: μLithp - a Lisp in 27 lines of Ruby

#22
post #4

1993: «Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.» [1] 20 years later: for Ruby users, situation improves! :) [1] http://en.wikipedia.org/wiki/Greenspuns_tenth_rule

Don't forget the corollary: https://en.wikipedia.org/wiki/Greenspuns_tenth_rule#Morris.2....

:)

Re: μLithp - a Lisp in 27 lines of Ruby

#23
post #2

Is it normal that I don't have the slightest idea what I'm reading here, or is it just me?

http://www.defmacro.org/ramblings/lisp.html

I have been playing with a Clojure, a Lisp dialect, for six or so months (it seems so much longer), but this was still really interesting to me.

Re: μLithp - a Lisp in 27 lines of Ruby

#25
post #6

Cool project, but I think it's been done before in less lines: https://gist.github.com/4176087

I've never understood the line-count craze some people get on. If it was that important, we'd all be using J or APL. Since we're not — in fact, almost nobody is — it must not be that critical.

It's just supposed to be fun, challenging, and a learning experience.

Re: μLithp - a Lisp in 27 lines of Ruby

#26
post #6

Cool project, but I think it's been done before in less lines: https://gist.github.com/4176087

I've never understood the line-count craze some people get on. If it was that important, we'd all be using J or APL. Since we're not — in fact, almost nobody is — it must not be that critical.

> If it was that important, we'd all be using J or APL.

Fallacy. You haven't eliminated the possibility that line count is important, but also that too few lines is also bad. It's widely understood that line count, even though it's a hazy and exploitable metric, is indeed important. It's also widely understood that being too terse is as bad as being too verbose. Time to brush up on some old-school CS curriculum books. (Mythical Man-Month? I'm not sure if the above is discussed there, but it's a good place to start.)

Re: μLithp - a Lisp in 27 lines of Ruby

#27
post #7
post #2

Is it normal that I don't have the slightest idea what I'm reading here, or is it just me?

If you don't know what Lisp is, and are a programmer, it's high time to go read about its basic principles. Lisp is very simple and very powerful. Those who don't learn it are doomed to reinvent it, badly ( cough XSLT cough ).

I'm not exactly a programmer. Could you explain how Lisp can be simple and powerful?

Re: μLithp - a Lisp in 27 lines of Ruby

#30
post #9

You should use Docco for your page, I find it much more readable: http://jashkenas.github.com/docco/

Ah, but this is org-mode! He can evaluate his code inside his editor! Grumble rah rah emacs!

He could probably set up his publish templates to accomplish the same formatting.

(huge org mode nerd, checking in)

--- EDIT ---

And what do you know, Eric Schulte already implemented this for org mode! It's checked in under contrib.

Instructions: http://eschulte.me/org-docco/org-docco.html

Org source: http://orgmode.org/w/?p=org-mode.git;a=blob_plain;f=contrib/...

Post reply on HN