Dear all,

I would like to know how to return from a fold, yielding a value that does not depend on the underlying sequence.

Example:

0 (4 : '(x+y)') F:. ] i. 5

yields '0 1 3 6 10'

using

0 (4 : '(x+y)[(_2 Z: 3=x)') F:. ] i. 5

stops the fold and returns '0 1 3'

But I do not understand if/how I could return a chosen value signaling an early fold termination, such as:

0 (4 : '(x+y)[ ... ') F:. ] i. 5

where in place of '...', one could write something causing this line to return 'early return' or 0 or another chosen value that has nothing to do with the underlying sequence.

Is that possible?

Thanks!

Raoul

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

Reply via email to