Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] looping recursion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: briand@a...
Subject: Re: [Caml-list] looping recursion
>>>>> "Brian" == Brian Hurt <bhurt@spnz.org> writes:

  Brian> Take a look at ExtLib:
  Brian> http://sourceforge.net/projects/ocaml-lib/

thanks for the link.

  Brian> This contains a drop-in compatible replacement to the List
  Brian> library, which includes a List.map function that doesn't blow
  Brian> up.

  Brian> If your list is that long, I'd actually recommend doing one
  Brian> of two things:

it really is.
although I'd actually like it to be an array.
it's the classic situation, read whole file - iterate on elements.
easy to do in a list since I don't need to know the size.

some minor tweaks and I can include the size in a data file and just
fill an array directly.

however, my larger point is the fact that the "standard" map blows up
like that.  as a long time scheme user I just find that plain weird.
Now Everybody else seems to think I'm weird because I think that's
weird ;-)

  Brian> Very long lists are a sign that you're using the wrong data
  Brian> structure.

I'm not sure I understand that.  I have 10^6 data points to work on.
I'm thinking a list or an array is the right data structure.  Although
an array is more right.  I mean if you are not worried about
efficiency then incremental transformation by map'ing is a very
elegant and clean way to go about doing that sort of work.

Part of the problem is that powerful computers make for lazy
programmers :-) It's just so easy to read the 10^6 elements into a
list and then just keep map'ing them to the final value when it only
takes seconds to do :-) If it took 2 minutes I'd be more inclined to
think about the problem.

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