Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] lisp to ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: yoann padioleau <padator@w...>
Subject: Re: [Caml-list] lisp to ocaml
>> Just all the parentheses gets a bit confusing for a first
>> look at lisp ;-)
>>
>
> The trick is:
>
> (1) Do not look at the parentheses. Read and write code by  
> indentation.
>
> (2) Use a text editor that helps you with this.
>
> (3) paren-sensitive syntax highlighting is a great thing.
>

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)))]
   ))

> You will find the parens to be much less confusing once you learned  
> not to
> look at them. :-)
>
>
> -- 
> 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)
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>