if we add 'a' to the definition of this function, (to make it work), the type of it turns out to be: [a] -> [(a, Bool)]<br><br>you might have forgotten the "map fst $" part.<br><br>Best,<br><br><div class="gmail_quote">
On 8 June 2010 14:51, Bill Atkins <span dir="ltr"><<a href="mailto:watkins@alum.rpi.edu">watkins@alum.rpi.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
f :: [a] -> [a]<br>
f = filter snd $ zip a (cycle [True, False])<br>
<div class="im"><br>
On Monday, June 7, 2010, Ozgur Akgun <<a href="mailto:ozgurakgun@gmail.com">ozgurakgun@gmail.com</a>> wrote:<br>
> or, since you don't need to give a name to the second element of the list:<br>
><br>
> f :: [a] -> [a]<br>
</div>> f (x:_:xs) = x : f xsf x = x<br>
<div><div></div><div class="h5">><br>
><br>
><br>
><br>
> On 7 June 2010 20:11, Ozgur Akgun <<a href="mailto:ozgurakgun@gmail.com">ozgurakgun@gmail.com</a>> wrote:<br>
><br>
> i think explicit recursion is quite clean?<br>
><br>
><br>
> f :: [a] -> [a]f (x:y:zs) = x : f zs<br>
><br>
> f x = x<br>
><br>
><br>
> On 7 June 2010 19:42, Thomas Hartman <<a href="mailto:tphyahoo@gmail.com">tphyahoo@gmail.com</a>> wrote:<br>
> maybe this?<br>
><br>
> map snd . filter (odd . fst) . zip [1,2..] $ [1,2,3,4,5]<br>
><br>
> 2010/6/6 R J <<a href="mailto:rj248842@hotmail.com">rj248842@hotmail.com</a>>:<br>
>> What's the cleanest definition for a function f :: [a] -> [a] that takes a<br>
>> list and returns the same list, with alternate items removed? e.g., f [0,<br>
>> 1, 2, 3, 4, 5] = [1,3,5]?<br>
>><br>
>> ________________________________<br>
>> The New Busy is not the old busy. Search, chat and e-mail from your inbox.<br>
>> Get started.<br>
>> _______________________________________________<br>
>> Haskell-Cafe mailing list<br>
>> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
>> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
>><br>
>><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
><br>
><br>
> --<br>
> Ozgur Akgun<br>
><br>
><br>
> --<br>
> Ozgur Akgun<br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Ozgur Akgun<br>