Slide 67
Slide 67 text
val sel = StateT(select[Int])
for {
s <- sel if s != 0
e <- sel
n <- sel
d <- sel
m <- sel if m != 0
o <- sel
r <- sel
y <- sel
send = List(s, e, n, d).reduce(_ * 10 + _)
more = List(m, o, r, e).reduce(_ * 10 + _)
money = List(m, o, n, e, y).reduce(_ * 10 + _)
if send + more == money
} yield (s, e, n, d, m, o, r, y)
MonadPlus
MonadPlus
https://speakerdeck.com/filippovitale/send-plus-more-equals-money-scalasyd-july-2015