CUSIP: Difference between revisions

Content added Content deleted
Line 323: Line 323:
set cs to "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*&#"
set cs to "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*&#"
set ns to mapMaybe(elemIndex(cs), s)
set ns to mapMaybe(elemIndex(cs), s)
script go
script go
on |λ|(f, x)
on |λ|(f, x)
set fx to |λ|(x) of mReturn(f)
set fx to apply(f, x)
(fx div 10) + (fx mod 10)
(fx div 10) + (fx mod 10)
end |λ|
end |λ|
end script
end script
9 = length of ns and item -1 of ns = (10 - (sum(zipWith(go, ¬
9 = length of ns and item -1 of ns = (10 - (sum(zipWith(go, ¬
cycle({my identity, my double}), ¬
cycle({my identity, my double}), ¬
Line 379: Line 381:
{type:"Tuple", |1|:a, |2|:b, length:2}
{type:"Tuple", |1|:a, |2|:b, length:2}
end Tuple
end Tuple


-- apply ($) :: (a -> b) -> a -> b
on apply(f, x)
-- The value of f(x)
mReturn(f)'s |λ|(x)
end apply