[clean-list] "dummies guide" to structuring a program for uniqueness typing

Diederik van Arkel dvanarkel at mac.com
Thu Aug 11 01:23:02 MEST 2005


On Aug 10, 2005, at 6:48 PM, Isaac Gouy wrote:

> I sorely feel the need for a guide to different approaches that might
> be useful in resolving "attribute at indicated position could not be
> coerced".
>
> As a beginner this feels like hitting an impassable wall, I simply
> don't know techniques that would allow me to restructure a program
> appropriately for uniqueness typing. Is there a "5 things to check for
> to resolve uniqueness typing errors" guide?
>
>
> These programs on The Computer Language Shootout fail because of
> "attribute at indicated position could not be coerced"
>
> nbody
> http://shootout.alioth.debian.org/benchmark.php? 
> test=nbody&lang=clean&id=0&sort=fullcpu
>
> word-frequency
> http://shootout.alioth.debian.org/benchmark.php? 
> test=wordfreq&lang=clean&id=0&sort=fullcpu
>
>
> I've been trying to implement a Clean version of spectral-norm but
> haven't found a way to resolve "attribute at indicated position could
> not be coerced".
>
> http://shootout.alioth.debian.org/benchmark.php? 
> test=spectralnorm&lang=all&sort=fullcpu

Hi Isaac, I can't help you with general guidelines. I can help some  
with your
specific cases...

in word-frequency change

         ht_buckets_to_list :: *[!Item a!] [Item a] -> [Item a]

to

         ht_buckets_to_list :: .[!Item a!] [Item a] -> [Item a]

And for nbody look at my attached version where I think I was playing  
with some
other aspect but which compiles successfully with 2.1.1

For spectral norm if you could show your code I can probably resolve  
the error for
you.

Regards,

Diederik van Arkel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: n_body.icl
Type: application/text
Size: 6684 bytes
Desc: not available
Url : http://mailman.science.ru.nl/pipermail/clean-list/attachments/20050811/2836289b/n_body.bin


More information about the clean-list mailing list