Validate International Securities Identification Number: Difference between revisions
Validate International Securities Identification Number (view source)
Revision as of 20:28, 30 May 2017
, 7 years ago→{{header|Haskell}}: A more legibile Luhn test
m (→{{header|Haskell}}: (edited out a duplication)) |
(→{{header|Haskell}}: A more legibile Luhn test) |
||
Line 919:
Or, making alternative choices from standard libraries:
<lang haskell>import
import qualified Data.Map as M
import Control.Monad (sequence, liftM2)
import Data.Maybe (fromMaybe)
Line 932 ⟶ 934:
elem (last isin) digits
luhn x =
let odd = [(: []), const []]
even = reverse odd
stream f = concat $ zipWith ($) (cycle f) (stringInts $ reverse x)
s1 = sum (stream odd)
in rem (s1 + s2) 10 == 0
capitals, digits :: String
|