Browse thread
[Caml-list] [camlp4] compiling against Pcaml module
[
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: | -- (:) |
| From: | Alexander V.Voinov <avv@q...> |
| Subject: | [Caml-list] a quick question on camlp4 |
Hi,
For a presentation which I'm about to make, I created a
simple (normal) syntax extension to imitate Python loop
over a sequnce:
iterate <list> with <fun> which maps to List.iter <fun> <list>.
This results in examples like:
iterate [1; 2; 3; 4] with function
| 2 -> printf "two\n"
| n -> printf "%d\n"
Is it possible to eliminate the keyword 'function' from this,
that is to implement an extension like:
iterate <list> with <pat1> -> <expr1> | <pat2> -> <expr2> ...
mapping to
List.iter (function <pat1> -> <expr1> | <pat2> -> <expr2> ...) <list>.
I'm asking this just because I don't have time now to investigate
this by my own :-).
Also, I was thinking about extensions like
let sum =
fold [10; 20; 30; 40] from 0.0 with
| val, sum -> val + sum
mapping to fold_left/fold_right.
Thank you in advance
Alexander
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners