Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Is there an "unscan" function? (Jeffrey Thornton)
----------------------------------------------------------------------
Message: 1
Date: Thu, 12 Jan 2012 19:43:31 -0600
From: Jeffrey Thornton <[email protected]>
Subject: Re: [Haskell-beginners] Is there an "unscan" function?
To: Stephen Tetley <[email protected]>
Cc: [email protected]
Message-ID:
<CAPXF-xLLb8HX7V5+daiYQw7bkL1BR52=sgckieepo7sf5dg...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Is "speed x" at least a somewhat universal term for the number of list
elements that get operated on per iteration? It works really well.
I was also wondering about what you just pointed out: if there's a nice way
to form (what I now know to call) speed >1 functions. Your form looks a lot
nicer than some of the stranger things I've been coming up with.
On Thu, Jan 12, 2012 at 1:37 AM, Stephen Tetley <[email protected]>wrote:
> Direct recursion is almost always clearer if you are traversing the
> list at a "different speed". The usual list functionals (map, filter,
> folds) are all speed 1 - traversing one element at a time. Here we
> want pairwise traversal:
>
> unscan :: (a -> a -> b) -> [a] -> [b]
> unscan f (a:b:bs) = f a b : unscan f b bs
> unscan _ _ = []
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20120112/de158566/attachment-0001.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 43, Issue 16
*****************************************