Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It translates very directly.

(((A B C) X Y) Z)

We could clean up this syntax and write a macro. Let's call that M. Then one could write

(M A (B C) (X Y) (Z))

The definition of M is quite simple.

Secondly, Lisp only uses lists for the representation of most of its source code. Actual computational data structures of course need not be lists. Mathematical expressions need not be represented as lists in Lisp.



I'm not sure they are quite equivalent, the semantics of pattern matching tend to be different: in lisps lists are always a kind of binary tree so (list 1 2 3) is really (1 . (2 . (3 . nil))), this has a consequence for unification in that (list 1 2 3) will match (x y) as 1 and (list 2 3). In Mathematica on the other hand lists tend to be flatter if you will, and there is this concept of Sequence which I sometimes find problematic.


I don't think that's true: (x y) is (x . (y . nil)) and shouldn't match (1 . (2 . (3 . nil))), because nil would have to match (3 . nil).


In Clojure,

  (-> A [B C] [X Y] [Z])




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: