[clean-list] Memoization of recursive functions using Clean arrays
Maks Verver
maksverver at geocities.com
Fri Aug 24 17:18:08 MEST 2012
Hi Pieter,
> Adding a type to a local definition always turns it into a function.
> This explains way adding a type to memo makes your program slow.
Ah, that's confusing, because my usual strategy when
experimenting/debugging with functional languages it to add type
declarations pretty much everywhere, to make sure that
functions/variables actually have the type that I think they do.
In the case of Clean, that apparently changes the runtime performance
of a program completely, which was pretty unexpected (though I
understand what's happening now).
> In the future we will most likely add special notation to indicate
> strict or unboxed arrays. For situations like this it is also
> desirable to have syntax that indicates lazy arrays.
Yes, it seems that there is an asymmetry in the syntax for creating
list and array literals. If I understood it right, it's possible to
create either generic lists (e.g. [|1,2,3]) or specific kinds of list
(e.g. [1,2,3] or [#1,2,3]), but an array literal always yields a
generic array.
Changing array literals to work the same way (e.g. {1,2,3} for a lazy
array, {|1,2,3} for a generic one) would break backward
compatibility, unfortunately.
Anyway, thanks for answering my questions! You've taught me a lot
about Clean these past days.
- Maks.
More information about the clean-list
mailing list