Hi I am trying to write a verb that will tell me if the digits in a number are distinct, e.g. return 1 for 1234 but return 0 for 1231
So far I have the following, but I feel it could be tidied up a bit. Any suggestions welcome filter =: 1 : #~ x digits =: 10&#.^:_1 distinct =: [: *./ "1 [: ~:"1 digits distinct filter 100 101 102 103 102 103 It seems to work OK (I appreciate that number lengths must all be the same to avoid padded zero problems), but are there any ways to tidy it up, especially re the "1 directives? Many Thanks ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
