On Fri, Mar 23, 2012 at 03:03:09PM +1300, Martin D Kealey wrote:
> On Thu, 22 Mar 2012, Carl Mäsak wrote:
> > Jonathan Lang (>>), Daniel (>):
> > >>    1, 2, 4 ... 100 # same as 1,2,4,8,16,32,64
> > >
> > > That last one doesn't work on Rakudo :-(
> >
> > And it never will. Note that 100 is not a power of 2, and that the goal
> > needs to match exactly. 
> 
> Hmmm, so it's likely that most times you get a Num rather than an Int or
> Rat, those won't stop either?
> 
>       1, 7 / 6.0 ... 2
>       1, sqrt(2), 2 ... 8

The expression 7/6.0 produces a Rat, so the first sequence properly 
stops at 2.

On Rakudo on my system, sqrt(2) indeed produces a Num,
but since floating point arithmetic doesn't result in
sqrt(2) / 1 == 2 / sqrt(2), no geometric sequence is deduced 
and the sequence fails with "unable to deduce sequence".

> Question: do we support
> 
>       1, 2i, -4 ... 256

I think this ought to work, but for some reason Rakudo on my system
hangs whenever I try it.  The following does work in Rakudo:

    > say 1, { $^x * 2i } ... 256
    1 0+2i -4+0i -0-8i 16+-0i 0+32i -64+0i -0-128i 256+-0i

The fact that the auto-deduced sequence hangs probably needs to be
filed as a bug report for Rakudo.

Pm

Reply via email to