Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 
original?

> 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?

Cheers,
Jon.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners