[Haskell-cafe] Comments and suggestions on code
Andre Nathan
andre at digirati.com.br
Fri Jan 11 10:27:33 EST 2008
On Thu, 2008-01-10 at 20:37 -0800, Jonathan Cast wrote:
> It might be faster; laziness usually has higher constants than direct
> implementations. But I doubt the difference is critical in this
> case, and I would definitely time a re-writing and throw it away
> unless it was significantly faster. But I don't think this is a case
> where laziness actually alters either the time or the space
> asymptotics of the algorithm (you end up creating an ~ O(n) tree
> anyway, so I'd figure O(n) space was OK for the loop, too).
I was wondering if laziness would make it run as if it was a single O(n)
operation (get one directory entry "on demand", pass it to filter and
then to insertInTree), because only one entry is used at a time, so that
only the "current" entry needs to be evaluated.
I still find it hard to evaluate the effects of laziness on the
complexity of programs...
Andre
More information about the Haskell-Cafe
mailing list