Juggle Home - Bits'n'Pieces - Feature Hitlist - Problem Reports - Mailing lists - The J Repository - References +-------------------+ | 9!:12'' | |5 | +-------------------+

Emergency Breaks for J/Unix

You can interrupt the currently running J program by hitting Ctrl-C:
J 4.02  Copyright (c) 1990-1998, Iverson Software Inc.  All rights
reserved.

loopdemo =: monad define
        for_i. i. y. do.
        1!:2&2 i        NB. write to screen
        6!:3 ] 5        NB. 5 seconds delay
        end.
        y.
)
   loopdemo 4
0
1
2
3
4
   loopdemo 4
0
1
^C|break: loopdemo
|       6!:3]5        NB. 5 seconds delay

The break is an event which will trigger the debugger or any try./catch. if enabled.

Note that a break can only take effect after a J primitive (or, at the discretion of the implementation, even a phrase of a few primitives) has been completed. In the example above, you have to wait until the currently running pause is completed. Likewise for long running matrix computations, blocking reads from a socket etc.

+-------------------+ | 9!:12'' | |5 | +-------------------+ Juggle Home - Bits'n'Pieces - Feature Hitlist - Problem Reports - Mailing lists - The J Repository - References