Version française
Home     About     Download     Resources     Contact us    
Browse thread
parameterized pattern
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lukasz Stafiniak <lukstafi@g...>
Subject: Re: [Caml-list] parameterized pattern
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
>