
25 Sep
2012
25 Sep
'12
8:17 p.m.
On 26/09/2012, at 5:56 AM, Gwern Branwen wrote:
On Tue, Sep 25, 2012 at 1:42 PM, Rishabh Jain
wrote: f x 0 = [] f (x:xs) y | x `mod` 2 == 0 = x : (f xs y) | otherwise = x : (f xs (y-1))
f [0..] 4 [0,1,2,3,4,5,6,7]
Tsk, tsk. So ugly. How's this:
let f x = take x . filter odd
Wrong. The original poster gave an explicit example in which even elements were *retained* in the output, they just weren't *counted*.