caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Alexander V.Voinov" <avv@quasar.ipa.nw.ru>
To: daniel.de_rauglaudre@inria.fr
Cc: caml-list@inria.fr
Subject: [Caml-list] a quick question on camlp4
Date: Thu, 17 Oct 2002 09:28:31 -0700 (PDT)	[thread overview]
Message-ID: <20021017.092831.59477872.avv@quasar.ipa.nw.ru> (raw)
In-Reply-To: <20021017182648.G32600@verdot.inria.fr>

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


  reply	other threads:[~2002-10-17 16:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-17 16:08 [Caml-list] [camlp4] compiling against Pcaml module Stefano Zacchiroli
2002-10-17 16:21 ` Daniel de Rauglaudre
2002-10-17 16:23   ` Daniel de Rauglaudre
2002-10-17 16:22 ` Samuel Lacas
2002-10-17 16:26   ` Daniel de Rauglaudre
2002-10-17 16:28     ` Alexander V.Voinov [this message]
2002-10-17 16:55       ` [Caml-list] a quick question on camlp4 Daniel de Rauglaudre
2002-10-17 17:07         ` Alexander V.Voinov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021017.092831.59477872.avv@quasar.ipa.nw.ru \
    --to=avv@quasar.ipa.nw.ru \
    --cc=caml-list@inria.fr \
    --cc=daniel.de_rauglaudre@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).