Re: takeWhile ?

2017-09-11 Thread Marc Chantreux
On Mon, Sep 11, 2017 at 10:16:50PM +0200, Timo Paulssen wrote: > the first expression uses ^ as a prefix operator on *, so it gives you > "a list of numbers 0 through * - 1" instead of "the number *" to compare > against *, so it's as if you had rounded the value up before comparing to 2. and now

Re: takeWhile ?

2017-09-11 Thread Timo Paulssen
the first expression uses ^ as a prefix operator on *, so it gives you "a list of numbers 0 through * - 1" instead of "the number *" to compare against *, so it's as if you had rounded the value up before comparing to 2.

Re: takeWhile ?

2017-09-11 Thread Marc Chantreux
On Mon, Sep 11, 2017 at 10:07:32PM +0200, Timo Paulssen wrote: > If I understand your problem correctly, you can simply use ...^ to leave > out the last element :) wow ... i tried it once but failed. and now i just spotted the error: i wrote (116, * * .6 ... ^ * < 2 ).say instead of

Re: takeWhile ?

2017-09-11 Thread The Sidhekin
On Mon, Sep 11, 2017 at 10:01 PM, Marc Chantreux <kha...@phear.org> wrote: > hello, > > doing maths with my kid, i just translated his spreadsheet with those > lines of haskell: > > rebonds height loss = height : rebonds (height - height * loss) > loss >

Re: takeWhile ?

2017-09-11 Thread Timo Paulssen
= height : rebonds (height - height * loss) loss > main = print $ takeWhile (> 2) $ rebonds 116 0.6 > > then i wanted to make it as short as possible in perl6, i'm almost > there: > > (116, * * .6 ... * < 2 ).say > > but the first $_ < 2 remains in the

takeWhile ?

2017-09-11 Thread Marc Chantreux
hello, doing maths with my kid, i just translated his spreadsheet with those lines of haskell: rebonds height loss = height : rebonds (height - height * loss) loss main = print $ takeWhile (> 2) $ rebonds 116 0.6 then i wanted to make it as short as possible in perl6, i'm alm