Validate International Securities Identification Number: Difference between revisions
Validate International Securities Identification Number (view source)
Revision as of 18:15, 30 May 2017
, 7 years ago→{{header|Haskell}}: (edited out a duplication)
m (→{{header|Haskell}}: (combined some type signatures)) |
m (→{{header|Haskell}}: (edited out a duplication)) |
||
Line 920:
Or, making alternative choices from standard libraries:
<lang haskell>import qualified Data.Map as M
import Control.Monad (sequence, liftM2)
import Data.Maybe (fromMaybe)
validISIN = liftM2 (&&) isinPattern (luhn . (show =<<) . stringInts)
isinPattern isin =
Line 938:
fmap (uncurry (+) . (`quotRem` 10)) .
zipWith id (cycle [id, (2 *)]) . stringInts . reverse
capitals, digits :: String
Line 957 ⟶ 953:
main =
mapM_
(print . ((,) <*>
[ "US0378331005"
, "US0373831005"
|