Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] composing functions...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] composing functions...
On Thu, 2005-12-01 at 13:55 +1300, Jonathan Roewen wrote:
> Hi,
> 
> I'm getting a bit stuck, and am wondering if there's anyway to compose
> a bunch of functions together easily without having to pre-maturely
> apply any of them.

let compose f g x = f (g x)

let h = compose f g

You can of course fold 'compose' over a list if all the
functions have the same type, if not, then you can't
make the list in the first place :)

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net