34.10.1 Send More Money

Let us return briefly to the Send More Money problem (see A Constraint Satisfaction Problem). Its sum/8 predicate will expand to a space-efficient conjunction of library constraints. A faster but more memory consuming version is defined simply by changing the neck symbol of sum/8 from `:-' to `+:', thus turning it into an FD predicate:

     sum(S, E, N, D, M, O, R, Y) +:
                       1000*S + 100*E + 10*N + D
          +            1000*M + 100*O + 10*R + E
          #= 10000*M + 1000*O + 100*N + 10*E + Y.