[Haskell-cafe] Function composition confusion
ANUJS at Amdocs.com
Wed Apr 27 09:46:20 EDT 2005
Thanks, that clears it up
I was thinking that the output of (splitAt blockSize) would get piped to (splitAt blockSize . snd).
Did not realize it goes to the whole iterate part.
From: Henning Thielemann [mailto:lemming at henning-thielemann.de]
Sent: Wednesday, April 27, 2005 4:37 PM
To: Anuj Seth
Cc: haskell-cafe at haskell.org
Subject: Re: [Haskell-cafe] Function composition confusion
On Wed, 27 Apr 2005, Anuj Seth wrote:
> Excuse the newbie'ness of my question.
> Saw an example in Two Dozen Questions by Rexx Page.
> blocks blockSize =
> takeWhile ( not . null ) . map fst .
> iterate (splitAt blockSize . snd) . splitAt blockSize
> What is the meaning of the . operators outside the parentheses ?
The same as inside. :-)
(splitAt blockSize) transforms a list to a pair of lists. So imagine a
list input at the right of (splitAt blockSize) and a pair output at the
left. This pair is piped into the 'iterate' part which transforms a list
of pairs into a list of pairs of lists. This in turn is piped to (map fst)
and so on.
The information contained in this message is proprietary of Amdocs,
protected from disclosure, and may be privileged.
The information is intended to be conveyed only to the designated recipient(s)
of the message. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, use, distribution or copying of
this communication is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.
More information about the Haskell-Cafe