Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Pointfree style considered pointless?

Name: Anonymous 2007-03-16 9:40 ID:+EPhLk32

In attempting to achieve satori, I tried to convert the following function to pointfree style:
x `divisibleBy` y = x `mod` y == 0
My first attempt looked like this:
divisibleBy = (== 0) . mod
Of course this doesn't work because mod is a two arg function and (.) requires a one arg function. So I turned to an acquaintance for help. He suggested:
divisibleBy = ((== 0) . ). mod
This works, but it's fugly. In my original version it's immediately obvious what it's doing; the pointfree version is anything but obvious. Discuss.

Name: Anonymous 2007-03-23 5:07 ID:Dv+koQAe

Pointless style is the win:
 > isIndex x = notNull x && isDigits x
I think not!
 > isIndex = uncurry (&&) . (&&&) notNull isDigits
Much better!


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List