Live data from Hacker News

μLithp - a Lisp in 27 lines of Ruby

fogus.github.com

71–80 of 104 posts

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

#71
Don't call it Lisp.

Lisp begins with something like this:

  (defmacro when (test &body forms)
      `(cond (,test nil ,@forms)))
Without using underlying list structure, environments, lexical scoping and reader function it is just a lisp-like syntax.

Lisp without lists at its core is nothing but another clumsy language. Look at Clojure - what a mess.

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

#72
post #5

Earlier quoted context omitted.

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,…

Clojure is immutable by default what does this sentence mean? How Scheme is less immutable by default?

Which data-structures are not first class "objects" in Scheme?

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

#73
post #5

Earlier quoted context omitted.

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

Clojure has cleaner syntax and matches the expectations of people used to languages that assume an underlying POSIX-like operating system.

Could you, please, provide us an examples of syntax and expectations?

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

#74

Don't call it Lisp. Lisp begins with something like this: (defmacro when (test &body forms) `(cond (,test nil ,@forms))) Without using underlying list structure, environments, lexical scoping and reader function it is just a lisp-like syntax. Lisp without lists at its core is nothing but another clumsy language. Look at Clojure - what a mess.

What's the problem with Clojure?:

    (defmacro when
	  "Evaluates test. If logical true, evaluates body in an implicit do."
	  {:added "1.0"}
	  [test & body]
	  (list 'if test (cons 'do body)))
Moreover, what's the problem with μLithp?

    l.eval [:label, :second, [:quote, [:lambda, [:x],   [:car, [:cdr, :x]]]]]

    l.eval [:second, [:quote, [1, 2, 3]]]
Seems list-y enough for me. I have a feeling that you didn't actually read the article.

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

#75
post #33
post #31

Earlier quoted context omitted.

I do lack a C-S degree, however I've been a PHP developer for years and recently switched to Ruby, or more specifically RoR.

This video course should explain the whole situation and more and is targeted at undergrads with essentially no background knowledge: http://ocw.mit.edu/courses/electrical-engineering-and-comput... Ignore the hairdos, it's from the 80s, the information itself ages better than the fashion.

Very useful, thanx!

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

#77

Don't call it Lisp. Lisp begins with something like this: (defmacro when (test &body forms) `(cond (,test nil ,@forms))) Without using underlying list structure, environments, lexical scoping and reader function it is just a lisp-like syntax. Lisp without lists at its core is nothing but another clumsy language. Look at Clojure - what a mess.

What's the problem with Clojure?: (defmacro when "Evaluates test. If logical true, evaluates body in an implicit do." {:added "1.0"} [test & body] (list 'if test (cons 'do body))) Moreover, what's the problem with μLithp? l.eval [:label, :second, [:quote, [:lambda, [:x], [:car, [:cdr, :x]]]]] l.eval [:second, [:quote, [1, 2, 3]]] Seems list-y enough for me. I have a feeling that you didn't actually read the article.

There isn't any problem with this Clojure macro. If you would like to see problems with Clojure, take a look at keep function in core.clj.

There is a classic function:

  (define (filter fn l)
      (cond ((null? l) '())
	  ((fn (car l)) (cons (car l) (filter fn (cdr l))))
	  (else (filter fn (cdr l)))))
The point is that stuffing more data-structures into a lisp ruins it. Somehow switching to the prefix notation and adding parenthesis doesn't transform Java to Lisp.

For the second piece of code - are't semicolons and comas somehow redundant?

Moreover, what is the point of writing something this way?

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

#78
post #38
post #27

Earlier quoted context omitted.

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

Chess has relatively simple rules (initial board layout, legal moves, win condition, some fanciness with en passant and castling, etc), but the game is endlessly complex, and there are more boards than a human being could ever see in his or her lifetime. Lisp is similar in that regard.

I'd say comparing it with Go might be easier, it has 8 rules, and can be played on a board of any size. I like to compare that to the 10 commandments in "The Little Schemer" or the 9 functions in μLithp.

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

#79

Earlier quoted context omitted.

What's the problem with Clojure?: (defmacro when "Evaluates test. If logical true, evaluates body in an implicit do." {:added "1.0"} [test & body] (list 'if test (cons 'do body))) Moreover, what's the problem with μLithp? l.eval [:label, :second, [:quote, [:lambda, [:x], [:car, [:cdr, :x]]]]] l.eval [:second, [:quote, [1, 2, 3]]] Seems list-y enough for me. I have a feeling that you didn't actually read the article.

There isn't any problem with this Clojure macro. If you would like to see problems with Clojure, take a look at keep function in core.clj. There is a classic function: (define (filter fn l) (cond ((null? l) '()) ((fn (car l)) (cons (car l) (filter fn (cdr l)))) (else (filter fn (cdr l))))) The point is that stuffing more data-structures into a lisp ruins it. Somehow switching to the prefix notation and adding parenth…

Not sure what the objection to the keep function is, other than maybe the performance optimisations that chunked sequences allow. Taking away the chunked consideration gives something like:

    (let [x (f (first s))]
      (if (nil? x)
        (keep f (rest s))
        (cons x (keep f (rest s)))))
Which looks almost identical (with differences, as you seem to be giving filter rather than keep, which are different functions). The library function COULD be defined like this, it just wouldn't be as fast.

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

#80

Earlier quoted context omitted.

What's the problem with Clojure?: (defmacro when "Evaluates test. If logical true, evaluates body in an implicit do." {:added "1.0"} [test & body] (list 'if test (cons 'do body))) Moreover, what's the problem with μLithp? l.eval [:label, :second, [:quote, [:lambda, [:x], [:car, [:cdr, :x]]]]] l.eval [:second, [:quote, [1, 2, 3]]] Seems list-y enough for me. I have a feeling that you didn't actually read the article.

There isn't any problem with this Clojure macro. If you would like to see problems with Clojure, take a look at keep function in core.clj. There is a classic function: (define (filter fn l) (cond ((null? l) '()) ((fn (car l)) (cons (car l) (filter fn (cdr l)))) (else (filter fn (cdr l))))) The point is that stuffing more data-structures into a lisp ruins it. Somehow switching to the prefix notation and adding parenth…

[deleted]
Post reply on HN