[Haskell-cafe] Is lazyness make big difference?
Donald Bruce Stewart
dons at cse.unsw.edu.au
Thu Feb 15 06:38:49 EST 2007
nick.linker:
>
> Hi all,
> (Another topic stolen from a Russian forum discussion).
> As everyone know, there are lot of strict languages, that
> have possibilities to "switch on" lazy evaluation when
> needed.
> But the examples that I saw on Haskell, there was not much
> use of lazy evaluation, often there were just several lazy
> points, and the rest could be done strictly without loss of
> generality. For example, in finding primes:
>
Some good examples are on the shootout:
The lazily generated trees in particular,
http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&lang=all
(note the much smaller memory footprint)
And here, a lazy infinite DNA sequence generator:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=fasta&lang=ghc&id=2
(the cycle alu part generates an infinite dna stream, which we then
print only as much of as we need. Greatly simplifies the code).
-- Don
More information about the Haskell-Cafe
mailing list