I'm writing a function which goes roughly as the following: "from the input 
array, take first element and do Foo to it. If the result is X, stop, otherwise 
get second element and do Foo to it. If the result is X, stop... etc. If the 
result of last element is still not X, return Y"

I started to write like this:

Foo y

and then I realize that I'm doing Foo to all elements of input at once, even 
those which potentially won't be needed.

So, trying to be optimal complicates things. A familiar observation.

What would be an advice to J-ers? Clarity of idea - or, in extreme cases, 
soundness of algorithm? Or, rather, how to find a balance here?


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

Reply via email to