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] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-29 (02:00)
From: Jon Harrop <jdh30@c...>
Subject: Re: [Caml-list] [ANN] The Missing Library
On Thursday 29 April 2004 2:03 am, skaller wrote:
> You are missing the point.

I sure am. ;-)

> Neither solution control inverts.

Does that mean that my function is being called by map, rather than having my 
function explicitly fetch the next element?

So, is this "control inverted":

let print string_of l =	
  let rec helper l = match l with
    [] -> ""
  | h::[] -> "; "^(string_of h)^"]"
  | h::t -> "; "^(string_of h)^(helper t) in
  print_string (match l with
    [] -> ""
  | h::t -> "["^(string_of h)^(helper t))

> So they're both weak.

By this, do you mean that "control inverted" functions are more generic?

If the above function is control inverted, in what way is it better than my 

> In the control inverted solution
> you aren't not called with some state,

Is that the same as "you are called with some state"?

> you do the calling
> so you can use for example let/bindings and recursion
> to maintain state "functionally": you cannot do that
> with the callback driven model, you're forced to use
> mutable state.

Can you give me a simple example where you are forced to use mutable state?


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: