<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">You're getting ahead of me again.<br><br>Michael<br><br>--- On <b>Sun, 4/12/09, Jake McArthur <i><jake.mcarthur@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Jake McArthur <jake.mcarthur@gmail.com><br>Subject: Re: [Haskell-cafe] Functions that return functions<br>To: "michael rice" <nowgate@yahoo.com><br>Cc: haskell-cafe@haskell.org<br>Date: Sunday, April 12, 2009, 5:45 PM<br><br><div class="plainMail">michael rice wrote:<br>> Admittedly, functions that return functions are Lispy, but perhaps there a Haskelly way to accomplish the same thing?<br><br>Actually, I think you will come to find that this way of thinking is more Haskelly than it is Lispy!<br><br> import Control.Applicative ((<$), (<*>))<br> import
Control.Arrow ((&&&))<br> import Control.Monad (guard)<br> import Data.List (unfoldr)<br><br> makeVerifier f m = (==0) . (`mod` m) . sum . zipWith f [1..] . unfoldr nextDigit<br> where nextDigit = (<$) . (snd &&& fst) . (`divMod` 10) <*> guard . (/= 0)<br><br>- Jake<br></div></blockquote></td></tr></table><br>