[Haskell-cafe] Re: Debugging methods for haskell
Jon Fairbairn
jon.fairbairn at cl.cam.ac.uk
Thu Jul 16 10:49:07 EDT 2009
Fernan Bolando <fernanbolando at mailc.net> writes:
> On Thu, Jul 16, 2009 at 4:10 PM, Jon
> Fairbairn<jon.fairbairn at cl.cam.ac.uk> wrote:
>
>> I wonder if your code has to use !! at all? I took a look at a random
>> module from the above link, and (without making much attempt at
>> understanding it), I'd guess that using accumArray and friends would be
>> more appropriate. Mostly you don't want to be doing indexing on lists.
>
> Most of the !! are used to access a list of parameters similar to
> accessing structures in C.
Ah. I wondered why so many of them were x!!0. list!!constant is almost
always something that could be done better.
> I am not particularly sure how to apply accumArray for something like
> that?
You [probably] don't. My apologies for not looking more carefully (I
really did just glance at it), but the remark about not using !! still
stands. I've been trying to look at your source again, but the link
doesn't respond to requests at the moment, so I can't be much help.
Haskell has much richer mechanisms for doing structure-like things than
C. Tuples and data types being the most obvious.
--
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
More information about the Haskell-Cafe
mailing list