Browse thread
[Caml-list] looping recursion
[
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: | brogoff <brogoff@s...> |
| Subject: | Re: [Caml-list] looping recursion |
On Wed, 28 Jul 2004, Alex Baretta wrote: > brogoff wrote: > > Sometimes lists are best. If lists are OK for 100, 1_000, or 10_000 items, > > why not 100_000 or 1_000_000? Map and friends shouldn't blow stack. > > > > -- Brian > > Actually, it's not that bad. Well, I'm still on the caml-list, so of course it isn't *that* bad. Also, as I said, if you need a tail recursive map over built in lists, you have at least two options. Unfortunately, my preference is to use Obj, which IMO points to a deficiency in the core language. Most, maybe all, of my issues with OCaml, amount to petty complaints, no showstoppers or dealbreakers. Hey, at least I'm not whining about the license! > Sometimes I design an algorithm in terms of basic data structures, such > as lists, and transformations applied through higher order iterators. > Such "featurs" as the stack overflow in List.map or the Linux > out-of-memory SIGKILL give me a clear indication of the simplemindedness > of such algorithms and force me to rethink them in terms of more > efficient structures and techniques, typically streams and laziness. There are quite a few cases where singly linked lists are the most efficient data structure, and they're just right for the problem. Streams and laziness are not at all efficient in comparison. Stack overflow commonly happens when one of my users (yup, I have users of my code who aren't me ;-) decides to run on data much larger than I'd anticipated. Also, lists are builtin, and have syntactic support in OCaml, by which I mean nice, easy to read syntax. So the language encourages you to use them. -- Brian ------------------- 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