Hacker News new | past | comments | ask | show | jobs | submit login

In Lisp, you put the "operator" first, so instead of

  2 + 3 + 4
you write

  (+ 2 3 4)

This is nice for associative operations like + or *, very very very slightly confusing for - and /

---

You use the same style for comparisons, so instead of

  2 == 3 == 4
you write

  (== 2 3 4)

To support the fist "infix" syntax, you need some magic in the == operator. But the second "prefix" syntax is totally natural and you need no magic in the parser or the operator.



I knew that Lisp does this operator first thing, it's everything around this that I'm not familiar with. What does ; do? Is the => an arrow or greater than or equal to? What is t? Do I guess correctly that most-negative-fixnum is like INT_MIN?


The semicolon is Lisp syntax for comments. T is the way you write true in Lisp. Most-negative-fixnum is the most negative number Lisp can represent without promotion to bignum (so it can be int_min if int is roughly equivalent to size_t).


> very very very slightly confusing for - and /

It's fine if you DNF it:

  (- a b c) => (+ a (- b) (- c))
  (/ a b c) => (* a (/ 1 b) (/ 1 c))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: