ok-4 wrote:
Someone mentioned the Blow your mind page.
One example there really caught my attention.
1234567 = (1357,246)
foldr (\a ~(x,y) - (a:y,x)) ([],[])
I've known about lazy match since an early version of the Haskell
report, but have never actually used it. Last night,
Dan Weston wrote:
I hate to be a party pooper, but isn't this just:
f = foldr (\a z - (a:snd z,fst z)) ([],[])
This takes less time to grok and takes no longer to run.
For each type with exported constructors, one can always write
deconstructors for it, if not already found in libraries.
Someone mentioned the Blow your mind page.
One example there really caught my attention.
1234567 = (1357,246)
foldr (\a ~(x,y) - (a:y,x)) ([],[])
I've known about lazy match since an early version of the Haskell
report, but have never actually used it. Last night, looking at
that example, the
I hate to be a party pooper, but isn't this just:
f = foldr (\a z - (a:snd z,fst z)) ([],[])
This takes less time to grok and takes no longer to run.
But why stop there?
import Control.Arrow
swap = snd fst
f = foldr (\a - swap first (a:)) ([],[])
Just read this aloud to see what it
Maybe something of these?
http://www.haskell.org/haskellwiki/Blow_your_mind
--
Chad Scherrer
Time flies like an arrow; fruit flies like a banana -- Groucho Marx
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On 2007-08-14, Spencer Janssen [EMAIL PROTECTED] wrote:
On Tuesday 14 August 2007 10:17:53 Dougal Stanton wrote:
I'm looking for cool but mind-bending examples of functional brilliance.
Let us say, hypothetically, you had a bathroom without any reading
material. And having read all the