[Haskell-beginners] list monad question
Matthias Guedemann
matthias.guedemann at ovgu.de
Fri Oct 30 09:32:35 EDT 2009
Hi Daniel,
> That gives
>
> combinations n xs = foldr f [[]] (replicate n xs)
>
> pointfree, for extra goodness:
>
> -- pointfree f inline
> combinations n xs = foldr ((. (. (:)) . flip map) . (>>=)) [[]] (replicate n xs)
> -- eliminate xs
> combinations n = foldr ((. (. (:)) . flip map) . (>>=)) [[]] . replicate n
> -- completely pointfree
> combinations = (foldr ((. (. (:)) . flip map) . (>>=)) [[]] .) . replicate
thank you, looks rather strange to me but works well.
regards
--
__________________________________________________________
___ __ __
Dipl. Inf. Matthias Guedemann / __\/ _\ /__\
Computer Systems in Engineering / / \ \ /_\
Otto-von-Guericke Universitaet Magdeburg / /___ _\ \//__
Tel.: 0391 / 67-19359 \____/ \__/\__/
__________________________________________________________
More information about the Beginners
mailing list