Re: python equivalent to haskells iterate.

2005-02-04 Thread Nick Coghlan
Graeme Caldwell wrote: What this does is takes as a paramter a decimal integer and converts it to a sequence in which each member is numeral from each position in the integer. For this specific problem, the builtin 'str' is your best bet: digit_list = map(int, str(val)) (If you only want to displ

python equivalent to haskells iterate.

2005-02-04 Thread Graeme Caldwell
Subject: equivalent to Haskell's iterate function.   While reading through "Two Dozen Short Lessons in Haskell". I came across the following function:   decimalNumeralFromInteger x = reverse [d | (s,d) <- takeWhile(/=(0,0)) (sdPairs x)] where    sdPairs x = iterate nextDigit (x `d