Browse thread
Having '<<', why to use '|>' ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-09-17 (21:44) |
From: | Fabrice Marchant <fabrice.marchant@o...> |
Subject: | Re: [Caml-list] Having '<<', why to use '|>' ? |
> I think it's just a matter of style. Your |> operator lets you write > "pipelines" similar to the Unix shell, in which evaluation flows > from left to right. I've typically used this when I'm applying the > function to all its arguments. I tend to use the traditional > composition operator (your <<), when I'm combining and passing > functional values around. Thanks a lot ! So I will not add the use of "|>" to my habits. Simply using "<<" will help to keep things simple. Only two or three operators seems very useful to me : This one avoids some parentheses and let the code clear. let ( @ ) f x = f x The composition operator : let ( << ) f g x = f @ g x This one, written like this, is not a true operator, but is very useful to adapt parameters order : let flip f x y = f y x This other one, like "|>", doesn't appear to be essential : let ( >> ) f g = ( << ) g f ( Can't write : let ( >> ) = flip ( << ) instead... ) Please are they other useful operators ? Regards, Fabrice