Live data from Hacker News

μLithp - a Lisp in 27 lines of Ruby

fogus.github.com

31–40 of 104 posts

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

#31
post #2

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

I can't say for sure- but I would guess that it would be normal for a lot of HN articles to go over your head if you are not technical or lack a C-S degree.

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.

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

#32

Yeah, 27 lines. Unless you count the ~120 lines of sexpistol. https://github.com/aarongough/sexpistol

Syntactic transformation isn't really what it's about, is it? Parsing S-expressions into some internal representation is easily the most boring component of a working Lisp.

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

#33
post #31

Earlier quoted context omitted.

I can't say for sure- but I would guess that it would be normal for a lot of HN articles to go over your head if you are not technical or lack a C-S degree.

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.

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

#35
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.

Why would anyone? Clojure runs on the JVM which supports native os threads, concurrent garbage collection, etc, for one thing. Different tools for different purposes.

The JVM also takes 100MB to startup a Web server. Maybe I want to use less ram?

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

#37
post #27
post #7

Earlier quoted context omitted.

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?

A lisp program's code can be manipulated by the program itself. Lisp programs are self-aware.

It's a bit mind-bending, but from this simple foundation comes the power to easily create and assimilate ever higher-level abstractions (which is what programming is really all about). Parts of a program can be used as a template for creating other parts as needed. You can assemble these parts and shape the language into something very specific for the problem you are solving.

Other languages come part-way, but don't fully embrace this concept (code=data) because it has a cost: it seems difficult to learn because it requires a change in thinking; it seems difficult to write (and read) because you're directly encoding a data structure and it all looks a bit 'samey'. Where other languages have 'shapes' in their code that give the trained eye an indication of what the code is expressing (such as for...do loops and indentation), lisp code has one shape: a tree [1].

I don't know if I've reached beyond your understanding. I haven't meant to, but the takeaway should be this: lisp programs are self-aware and can operate on themselves because a lisp program is just data like any other. This makes it easy for the interpreter/compiler (hence 'lisp in x lines of code'), but more difficult for the programmer (at first). As with all things, practice and familiarity overcome these initial difficulties. It is worth it.

[1] http://en.wikipedia.org/wiki/Tree_(data_structure)

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

#38
post #27
post #7

Earlier quoted context omitted.

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?

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.

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

#39
post #27
post #7

Earlier quoted context omitted.

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?

It would be more precise to say minimalistic, rather than simple.

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

#40

My one question is: Why?

It's weird that this question keeps coming out in several cool but not that useful HN posts.

Some times it's cool to do things just because you can, maybe he was bored or he always wanted to implement a lisp dialect.

It might not be that useful, but i'm sure that the autor had a blast doing it, otherwise he wouldn't have done it.

Post reply on HN