i think explicit recursion is quite clean?

f :: [a] -> [a]
f (x:y:zs) = x : f zs
f x = x



On 7 June 2010 19:42, Thomas Hartman <tphya...@gmail.com> wrote:

> maybe this?
>
> map snd . filter (odd . fst) . zip [1,2..] $ [1,2,3,4,5]
>
> 2010/6/6 R J <rj248...@hotmail.com>:
> > What's the cleanest definition for a function f :: [a] -> [a] that takes
> a
> > list and returns the same list, with alternate items removed?  e.g., f
> [0,
> > 1, 2, 3, 4, 5] = [1,3,5]?
> >
> > ________________________________
> > The New Busy is not the old busy. Search, chat and e-mail from your
> inbox.
> > Get started.
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe@haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Ozgur Akgun
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to