On Sat, 29 Jun 2002, Jon Fairbairn wrote:

> Shlomi Fish wrote:
> > No. But I want to generate an irregular series, which I determine the
> > intervals between two consecutive numbers myself. E.g:
> >
> > let (num1, next1) = (counter 5)
> >     (num2, next2) = (next1 100)
> >     (num3, next3) = (next2 50) in
> >     [num1,num2,num3]
> >
> > Will have the numbers [5, 105, 155].
>
> What do you mean by "determine"?
>

_I_ want to determine which step to go to next. I'd like to pass a
parameter the counter each time, and each time get the next number as well
as a new counter.

Regards,

        Shlomi Fish


> You can write
>
> sequence = iterate step_counter 0
>
> if the interval between successive numbers is determined by
> the current number, or
>
> sequence = map f [1..]
>
> if it's determined by the index in the sequence.
>
> or
>
> sequence =  map snd $ iterate step_counter (0,-7)
> step_counter (a,b) = (a+1, f a b)
>
> if it depends on both.
>
>
>   Jón
>



----------------------------------------------------------------------
Shlomi Fish        [EMAIL PROTECTED]
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       [EMAIL PROTECTED]

He who re-invents the wheel, understands much better how a wheel works.

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to