Randy Macdonald wrote:
The data analysis stuff that J seems to have abandoned is also of great
importance to APL developers: the data being the software we are
developing. It could be frustrating to discover how little of a
developer's time is spent knowing the correct answer to a problem. That
this is not frustrating in practice is because APL marbles tiny moments of
success into the whole process
I recently wanted to solve a problem which was in essence: find the first
x, a member of i. 10^9 where f x was true. Because 10^9 is a big number,
what I would do in APL was this: show progress in steps of 1000, and allow
me to interrupt the whole process (with Ctrl-Break) if it looks like it
will never find an answer, perhaps because I expected one sooner Nope.
As far as I can tell, display to the session is suppressed until a return
to immediate execution, and Ctrl-Break doesn't work at all.
I frequently have 'long' calculations, and like to track their progress.
Using a for. loop and script output to the session manager works fine in
reporting progress and Jbreak on the task bar works to create a break if it
is running too slowly and a rethink is needed. A typical function might be
long =: 3 : 0
for_i.
i.y
do.
v =. foo i
if. 0 < v
do. v return.
else.
if. 0 = 100 | i do. (i, 6!:0 '') 1!:2 (2) end.
end.
end.
)
It does not look very J-ish but when foo is a complex calculation the
control structure time costs are trivial in comparison and more important if
foo takes a lot of memory it can handle problems which would be far outside
the machine capacity otherwise.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm