[Haskell-cafe] Ultra-newbie Question

Alberto G. Corona agocorona at gmail.com
Mon Sep 20 04:53:06 EDT 2010

2010/9/18 Daniel Fischer <daniel.is.fischer at web.de>

> >      n_lastn n = reverse . take n . reverse
> Which is the most elegant definition, but it's an O(length list) space
> operation (as are all others proposed so far). T

No!. You forget laziness!.  it is 0(n) with n= the parameter passed to

It is not  O(length list).

the reversed and de-reversed elements are just the ones being taken , not
the whole list.

(please kill me if I´m wrong. I don´t want to live in a world where beauty
is inneficient)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100920/a16ceeb3/attachment.html

More information about the Haskell-Cafe mailing list