Hi,

I have a 'find' dyadic verb that takes a (array of) integer(s), walks the associative array recursively and yields the current element when not found in the associative array, as below:

var =: (4&=+.1&=)@(3!:0)

find =:([`((]$:~]{::~2;<@[i.~1&{::@]) :: [)@.(var@[))"(0 _)

Examples:

(1 2) find (0;(2;1);<(5.22;3.5))

(2 1) find (0;(2;1);<('';3.5))

Now, the 1st example works as expected, but when unifying with the empty list as in the 2nd example I get zeroes that (apparently??) are fill atoms. I'd like my result to respect J syntax (for syntactic unification) and therefore where the second example yields '0 3.5' I would like to get a syntax error.

Is this possible? One way I thought of would be to build the result as a string and execute it, but that would be dog-slow on larger data, wouldn't it?

Thanks for your consideration,

Raoul

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

Reply via email to