Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Patterns in ML vs OCaml ...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Vasili Galchin <vasiliocaml@y...>
Subject: [Caml-list] Patterns in ML vs OCaml ...

    I'm sorry this is a very elementary question (but I am pulling my hair out). With a function written in ML:
fun filter_list P []       = [] |
    filter_list P (h :: t) = let val ft = filter_list P t
                             in if P h then (h :: ft)
                                else ft
fun member (e, nil) = false |
    member (e , (h :: t)) = if (e=h) then true
                                     else member (e, t) ;

What is the preferred way to write in OCaml using pattern matching on parms??
Regards, Vasili

Do you Yahoo!? - Register online to vote today!