[plt-scheme] polymorphism of primitive types
On Oct 18, 2005, at 11:58 AM, Yoav Goldberg wrote:
>>> 2/ this doesn't solve my problem - the builtin map doesn't work on
>>> graphs.
>> Ah, that's a bug!!!! Thanks.
>
> How are you going to fix this bug? Comming to think of it, how did you
> make the builtin car and cdr work for these graphs?
>
>>> 3/ I prefer streams in this case as they give me much more
>>> flexibility
>>> - I can control their sizes, append them, merge them, etc.
>> All of this applies to rational graphs, too. Well, if you define the
>> functions ...
> How much memory will the graph of "1000 alternations of 1 and 2
> followed by 1000 alternations of 3 and 4" consume when constructed?
> (from what I understand, it will be like the equivalent list, which is
> ~2000. I would much prefer the lazy version in this case...)
You are creating and applying a closure.
There is an entire paper about how often people really need laziness
(FPCA 94 or 95). And the surprising thing is: little. Or not at all.
The good thing is that you want strict functions and lazy data
constructors, because that's the justified version.
-- Matthias