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"?

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
-- 
J�n Fairbairn                                 [EMAIL PROTECTED]
31 Chalmers Road                                         [EMAIL PROTECTED]
Cambridge CB1 3SZ            +44 1223 570179 (after 14:00 only, please!)


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

Reply via email to