First, we need a list of available digits, just the numbers 0 through 9:

CONSTANT:digits { 0 1 2 3 4 5 6 7 8 9 }

Next, we turn a sequence of digits into a number (e.g., { 1 2 3 4 } becomes 1234):

:>number( seq-- n) 0 [ [ 10 * ] dip + ] reduce ;

We can then implement our solver, by choosing digits while progressively restricting the possible values for future digits using the ones we've chosen so far (using local variables to store the digits):

Note: We search all solutions using amb-all (even though there is only one). In this case, it is effectively an iterative search, which we could implement without backtracking. If we wanted the first solution, we could use if-amb.

So, what's the answer? Let's see!

IN:scratchpad send-more-money
9567
+ 1085
= 10652

Neat! And it's fast too -- solving this puzzle in about 2.5 seconds on my laptop.