[Haskell-cafe] Removing alternate items from a list

Stephen Tetley stephen.tetley at gmail.com
Tue Jun 8 08:43:30 EDT 2010


The regular list functionals - map, zip, foldl, foldr, filter, etc. -
all process the input list at "speed 1" - i.e. one element at a time.

As Ozgur Akgun has shown - consuming the list at "speed 2" gives a
very pleasant implementation - algorithmically:
"consume at speed 2, produce the new list with the first element of
the two and drop the second".

Trying to code an algorithm at "speed 1" with the list functionals
presents a significant hurdle towards clarity of exposition...

Best wishes


More information about the Haskell-Cafe mailing list