It occurred to me that it would be useful for this
digit problem solving verb to allow the user to
see answers for partially worked-out cases.

This is a relatively simple change, but it changes some
of the underlying assumptions.  Also, after this change,
I see only two solutions for 'four = 4 * one' because it
excludes all solutions where a letter stands for the digit
four.

Anyways, here's the variant approach:

require'stats strings'
sub=: ~.@(#~ e.&(a.{~,65 97+/i.26))
dgt=: '0123456789'&-.
dgs=: dgt {~ [EMAIL PROTECTED]@sub ,/@({"1/) [EMAIL PROTECTED] comb [EMAIL 
PROTECTED]
pos=: (sub ,/@,."1 dgs) charsub"1 ]
ans=: (". # ])@pos

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to