HN user

axle_512

16 karma
Posts0
Comments13
View on HN
No posts found.

You don’t see them in the same sense you don’t see multiple closing braces in java or c.

The style in lisp is to keep all the closing paren on the same line: ))))

But in java or C you’ll sometimes see a function that ends like: } } } }

(Hmm my newlines didn’t cone thru on those braces)

Not exactly apples to apples comparison, but it illustrates how you can start to unsee those parens.

Fair enough, I see your point.

Though stylistically my personal preference is for the macro to remain as simple as possible with limited syntax introduced.

Note I said "or looks like one".

If you squint a bit, macros and built-ins are similar in structure to functions (they're all s expressions).

I agree with much of what you said, but I still maintain that lisp syntax is still relatively trivial compared to most languages.

I also don't think exposing newcomers to macros on a language that is homoiconic is terribly useful until they're already comfortable with the basic s-expression syntax.

In lisp, nearly everything is written in the same form. I.e. everything either is a function call or looks like one. Once you know that, you pretty much know lisp syntax.

People freak out about the parens. But I think what's the big deal? Functions are called with the paren in front of the function and the args space separated. so f(x, y) in C like syntax becomes: (f x y) - Whoop dee do, not so hard.

And since the syntax is extremely consistent, things that are math "operators" in other langs are just functions in lisp.

For "(+ 1 2 3)" + is actually the name of the function, so we are invoking + function and 1 2 3 are the arguments. Returns 6.

Once you know that, and that function args are evaluated before passed into the function, then you no longer have to worry about operator precedence and parenthesis to control order of operations. Once you get used to it, it's actually a lot simpler.

(* 2 (+ 5 5)) => 20

JetBrains based editors are quite nice if you can afford it. Free for students and open-source developers.

PyCharm for python, IntelliJ for java, Cursive for clojure

From my experience several years ago:

Distributing binaries for Linux was complex. libstdc++ compatibility across distros or different versions within a single distro wasn't great.

(Compared to Solaris, it seemed like libraries were always backwards compatible. Running old binaries always just worked.)

I used to have an issue with lisp syntax until someone pointed it out to me like this.

In c and java like languages, you invoke a function like this: f(x)

In lisp, just move the paren before the function name. What's the big deal? (f x)

Similarly, f(g(x)) becomes (f (g x)). All we did was move the paren before the function name.

The syntax is extremely consistent and it makes the lisp syntax trivial to learn. In nearly everything you do, the function name comes first the arguments come next. (+ 1 2) Here + is a function, and you are giving it 2 arguments. There are no special operators or syntax to learn. Just functions!

The mind blowing part comes when you realize that this consistent syntax combined with the fact that the code is really just written in lisp datastructures, is what makes lisp macros so powerful.

On the surface, you wouldn't think immutable data structures would offer any significant performance gains. But there are a lot of cool techniques and unforeseen consequences that emerge.

The clojure library "om" is able to use reference equality (instead of a deep comparison) to check for diffs. This results in a 2x or 3x performance gain over mutable data structures.

So I agree with you, this will likely just be a toy OS. But if his design demonstrate huge advantages, the ideas could be adopted by mainstream operating systems.