michael rice wrote:
Admittedly, functions that return functions are Lispy, but perhaps there
a Haskelly way to accomplish the same thing?
Actually, I think you will come to find that this way of thinking is
more Haskelly than it is Lispy!
import Control.Applicative ((<$), (<*>))
import Control.Arrow ((&&&))
import Control.Monad (guard)
import Data.List (unfoldr)
makeVerifier f m = (==0) . (`mod` m) . sum . zipWith f [1..] .
unfoldr nextDigit
where nextDigit = (<$) . (snd &&& fst) . (`divMod` 10) <*>
guard . (/= 0)
- Jake
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe