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: | 2004-04-28 (12:38) |
From: | Nicolas Cannasse <warplayer@f...> |
Subject: | Re: [Caml-list] [ANN] The Missing Library |
> > Why can't you do this kind of in ocaml? Returning something like a > > "next" function would seem to give you a very basic (but usable) > > iterator. Which part of the iterator abstraction can't you do? > > I suggest you try it. I don't know how to answer the question. > I think the answer is 'C++ templates provide functorial > polymorphism (polyadicity), Ocaml has no such expressive power.' > > HOF's like 'map' and 'fold' make sense > for polynomial data structures -- lists and trees etc. > But you have to write 'List.map' or 'Array.map'. There > is no single 'map' which works for all data structures > in Ocaml. There is ExtLib Enum.map that's pretty good at doing that. > There is in C++, and its a one line idiom: > > // STL copy > for(; i!=e; ++i) *o++ = *i++; > > Fold is as easy to define (called Accumulate in STL). > > These definitions are polyadic. They work for ALL > data structures -- provided they have iterators > of course :D That's exactly the same as ExtLib enums : define an enumerator for your data structure, and you can apply a full range of algorithms on it. I don't really understand the difference with STL. Regards, Nicolas Cannasse ------------------- 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