[Haskell] Re: Haskell Digest, Vol 31, Issue 15

Udo Stenzel u.stenzel at web.de
Fri Mar 17 16:18:19 EST 2006


minh thu wrote:
> to be clear, the data structure i'm thinking of is the "half edge" or
> "winged edge"

this would involve a cyclic structure, and you want to update that.  I
don't think there's a purely functional way to implement that, and if
there is, it wouldn't allow O(1) modifications.

So it appears, you will have to mangle pointers.  This is indeed
possible, pointers in Haskell are spelled "STRef".


> the idea of creating the data structure in plain c (and maybe the
> basic functions) and then use it (them) in haskell is bad ?

Do you honestly think that C is ever a good idea?  Of course, you can
write the data structure in C, but it will be essentially the same code
you would write in Haskell using STRefs.  Additionally you will get the
usual off-by-one errors, dangling pointers and the ever helpful error
message "killed by SEGSEGV".


Udo.
-- 
<Alanna> Saying that Java is nice because it works on all OS's is 
like saying that anal sex is nice because it works on all genders.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/haskell/attachments/20060317/4f042a91/attachment.bin


More information about the Haskell mailing list