Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Lukasz Stafiniak" <lukstafi@gmail.com>
To: "Serge Aleynikov" <serge@hq.idt.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] parameterized pattern
Date: Thu, 9 Nov 2006 00:55:36 +0100	[thread overview]
Message-ID: <4a708d20611081555i1f860911rfb7a29d31a34ce7a@mail.gmail.com> (raw)
In-Reply-To: <454FA5F8.5030106@hq.idt.net>

You can do this kind of ad-hoc polymorphism with with G'Caml:

http://web.yl.is.s.u-tokyo.ac.jp/~furuse/gcaml/

BTW, I think that G'Caml deserves more attention on this list (see
http://lambda-the-ultimate.org/node/1278). (I've even thought that it
is still a patch to OCaml 2.0, but it seems to be up-to-date now.)

You can check also a related attempt in Meta OCaml, by Oleg Kiselyov:

http://pobox.com/~oleg/ftp/ML/gprint/

(search the archives for "Generic print function").

On 11/6/06, Serge Aleynikov <serge@hq.idt.net> wrote:
> Hi,
>
> The section 6.6 of OCaml's manual introduces a notion of "Parenthesized
> patterns".
>
> I couldn't find any examples on how to use this feature, and brute-force
> approach doesn't work:
>
> # match 1.0 with
>   (y : float)  -> print_float y
> | (s : string) -> print_string s;;
> This pattern matches values of type string
> but is here used to match values of type float
> #
>
> Could anyone point at a suitable resource?
>
> Thanks.
>
> Serge
>
> --
> Serge Aleynikov
> Routing R&D, IDT Telecom
> Tel: +1 (973) 438-3436
> Fax: +1 (973) 438-1464
>
> _______________________________________________
> 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
>


  parent reply	other threads:[~2006-11-08 23:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-06 21:15 Serge Aleynikov
2006-11-06 23:58 ` [Caml-list] " Jon Harrop
2006-11-07  0:12   ` Serge Aleynikov
2006-11-06 23:59 ` Martin Jambon
2006-11-08 23:55 ` Lukasz Stafiniak [this message]
2006-11-09  1:45   ` brogoff
2006-11-09  5:19     ` Jon Harrop
2006-11-09  8:51       ` skaller
2006-11-09 16:22         ` brogoff
2006-11-09 17:55           ` skaller
2006-11-14 23:12           ` Don Syme
2006-11-15  1:00             ` brogoff
2006-11-15  1:36               ` Don Syme
2006-11-09  5:18   ` Jon Harrop
2006-11-09 16:42     ` micha

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=4a708d20611081555i1f860911rfb7a29d31a34ce7a@mail.gmail.com \
    --to=lukstafi@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=serge@hq.idt.net \
    /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