Browse thread
[Caml-list] lisp to ocaml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-09-18 (14:38) |
From: | Thomas Fischbacher <Thomas.Fischbacher@P...> |
Subject: | Re: [Caml-list] lisp to ocaml |
On Sun, 18 Sep 2005, yoann padioleau wrote: > You can also in some scheme (such as plt scheme) use other symbols than > parenthesis such as '[' ']'. > It reduces the number of () and makes some code looks better. > > for instance > > (defun factorial (n) > (cond [(= n 0) 1] > [(> n 0) (* n (fact (- n 1)))] > )) This gets somewhat off-topic now, but just for completeness, let me mention that one can easily modify the ANSI CL reader in such a way that some characters are handled by custom code, and just make [] or even {} behave as if they also were (). This works for every ANSI-compliant CL. (Not that I would recommend this in any way.) I see the attempt to learn ocaml as a first step to understand Lisp with somewhat mixed feelings. (Even though right now, I teach it for more or less just that reason...) Certainly, it is very useful in many situations to know some OCaml, but if one just wants to learn Lisp, but is too spoilt by some syntax-rich languages that the uniformity of Lisp's parens turns out to be a problem, it might or might not be more appropriate to instead start with a LISP with a bit more syntactic sugar on top of it, which can use reader-dispatch to parse blocks of semicolon-delimited infix statements... -- regards, tf@cip.physik.uni-muenchen.de (o_ Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\ (lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_ (if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)