2010/9/18 Daniel Fischer <daniel.is.fisc...@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 n_lastn. 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) ;)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe