RE: Random questions after a long haskell coding day

2002-01-29 Thread Simon Marlow
Simon Marlow [EMAIL PROTECTED] writes: Any thumb rule for using arrays? I'm expecting access to be O(1), it is right? In GHC, yes. (Shouldn't this really be required? I mean, the whole *point* of using arrays is to have O(1) random access, isn't it?) Can we also rely on

Re: Random questions after a long haskell coding day

2002-01-29 Thread Ketil Z. Malde
Simon Marlow [EMAIL PROTECTED] writes: Can we also rely on destructive updates for the monadic arrays? In GHC, yes :-) Goodie! One more question: I imagine arrays give an opportunity to optimize by unboxing the contained type -- any chance of that? How much space would an array of Chars

RE: Random questions after a long haskell coding day

2002-01-28 Thread Simon Marlow
Any thumb rule for using arrays? I'm expecting access to be O(1), it is right? In GHC, yes. Need to have a set of data, and I just want to get random elements from that Set, arrays seem like a good solution... am I right? If you're building it once and doing lots of access, then

Re: Random questions after a long haskell coding day

2002-01-27 Thread Jorge Adriano
On Sunday 27 January 2002 05:36, Hal Daume III wrote: For your last question (about reduction to hnf), use the attached code; search the haskell mailing list for deepseq for more. Thanks... I found myself trying to define a function deepSeq :: [a]-[a] to evaluate all the elements of the

Random questions after a long haskell coding day

2002-01-26 Thread Jorge Adriano
Am I the only one who'd like to have some the function specified by scan_and_fold f e xs= (scanl f e xs, foldl f e xs) In the Lists library. Or is it there somewhere and I missed it? What about: pair (f,g) x = (f x, g x) cross (f, g) = pair(f.fst, g.snd) I kind of like point free style.

Re: Random questions after a long haskell coding day

2002-01-26 Thread Hal Daume III
For your last question (about reduction to hnf), use the attached code; search the haskell mailing list for deepseq for more. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Sun, 27