I recently wrote a cryptarithmetic solver for a school project and have been tweaking it to try to improve it for fun. In the program, it takes the two operands and sum as lists, and creates a fourth list of unique variables in the problem. For example, from the problem EAT + THAT = APPLE, it creates the list (A H T P L E). It then assigns domains for each variable of 0-9 and trims the domains based some simple rules (such A in this case must equal 1). The program then sorts the domains by length, shortest-first, so that the most-restricted-value is leading when it sttarts to look for the answer.
Everything works, which I was happy for. I am new to lisp and it has been fun learning how to use it.
Now for the caveat. It works when I run it on Allegro CL, but does not on GNU CLisp. I have tracked down the problem to the sort function. When I sort the list of variables, it changes (A H T P L E) to (A T E H P L) as it should, but it is also changing the value of the list of variables for the sum. That is, it also changes the list (A P P L E) to (A P H P L).
I find this very odd. The sort function is not touching the sum list in any way I can tell. As I mentioned, this happens with GNU CLisp, but not with Allegro. I would prefer to use GNU as it runs leaps and bounds faster on my machine, but this oddness is throwing me off.
