Re: [Haskell-cafe] Re: Ultra-newbie Question

2010-09-20 Thread Luke Palmer
On Sun, Sep 19, 2010 at 5:01 PM, Henrique Becker henriquebecke...@gmail.com wrote: Why not? import Data.Number.Nat as N lastN :: Integral b = b - [a] - [a] lastN n xs = N.drop (N.length xs - n') xs        where n' = N.toNat n Wow. That is gorgeous! I think it's basically the same idea as

Re: [Haskell-cafe] Re: Ultra-newbie Question

2010-09-20 Thread Luke Palmer
On Mon, Sep 20, 2010 at 5:11 PM, Luke Palmer lrpal...@gmail.com wrote: On Sun, Sep 19, 2010 at 5:01 PM, Henrique Becker henriquebecke...@gmail.com wrote: Why not? import Data.Number.Nat as N lastN :: Integral b = b - [a] - [a] lastN n xs = N.drop (N.length xs - n') xs        where n' =

Re: [Haskell-cafe] Re: Ultra-newbie Question

2010-09-20 Thread Henrique Becker
Thanks, It's my first post. If you not import Prelude is more clear (N. is horrible): import Prelude ((-), Integral) import Data.Number.Nat (drop, length, toNat) lastN :: Integral b = b - [a] - [a] lastN n xs = drop (length xs - n') xs where n' = toNat n P.S.: You benchmarked? I

[Haskell-cafe] Re: Ultra-newbie Question

2010-09-19 Thread Henrique Becker
Why not? import Data.Number.Nat as N lastN :: Integral b = b - [a] - [a] lastN n xs = N.drop (N.length xs - n') xs where n' = N.toNat n Not import Prelude maybe make more clear. []'s Henrique Becker ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: Ultra-newbie Question

2010-09-18 Thread Maciej Piechotka
On Sat, 2010-09-18 at 03:51 -0400, Christopher Tauss wrote: Hello Haskell Community - I am a professional programmer with 11 years experience, yet I just do not seem to be able to get the hang of even simple things in Haskell. I am trying to write a function that takes a list and returns

Re: [Haskell-cafe] Re: Ultra-newbie Question

2010-09-18 Thread Gregory Crosswhite
Translation: Look at Data.Sequence sometime. On 9/18/10 11:15 AM, Maciej Piechotka wrote: On Sat, 2010-09-18 at 03:51 -0400, Christopher Tauss wrote: Hello Haskell Community - I am a professional programmer with 11 years experience, yet I just do not seem to be able to get the hang of even

Re: [Haskell-cafe] Re: Ultra-newbie Question

2010-09-18 Thread Gregory Crosswhite
Translation: Look at Data.Sequence sometime. On 9/18/10 11:15 AM, Maciej Piechotka wrote: On Sat, 2010-09-18 at 03:51 -0400, Christopher Tauss wrote: Hello Haskell Community - I am a professional programmer with 11 years experience, yet I just do not seem to be able to get the hang of even