Browse thread
[Caml-list] [ANN] The Missing Library
-
John Goerzen
-
Kenneth Knowles
- Alexander V. Voinov
-
John Goerzen
-
Maxence Guesdon
-
John Goerzen
- Maxence Guesdon
-
John Goerzen
-
Alain.Frisch@e...
-
John Goerzen
-
Alain.Frisch@e...
-
Nicolas Cannasse
-
Yamagata Yoriyuki
- Gerd Stolpmann
-
Nicolas Cannasse
-
Yamagata Yoriyuki
- Jacques GARRIGUE
- Nicolas Cannasse
-
Yamagata Yoriyuki
-
Yamagata Yoriyuki
-
Nicolas Cannasse
- oliver@f...
-
Alain.Frisch@e...
-
John Goerzen
- Henri DF
- Shawn Wagner
- james woodyatt
-
Alain.Frisch@e...
- Basile STARYNKEVITCH
-
John Goerzen
- Kenneth Knowles
- Florian Hars
-
Maxence Guesdon
- Eric C. Cooper
-
Kenneth Knowles
[
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: | -- (:) |
| 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