Version française
Home     About     Download     Resources     Contact us    
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 ...

Hello,
 
    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
                             end;
 
OR
 
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!?
vote.yahoo.com - Register online to vote today!