wolfram mathematica - How to abort evaluation of a sequence of inputs? -
by default pressing alt+. or calling abort[] within evaluation causes abort of evaluating input. when working in frontend send kernel sequence of inputs. example, if type following 3 expressions on separate lines in 1 cell , press shift+enter infinite evaluation:
f := checkabort[pause[.1], abort[]] while[true, f] while[true, f] while[true, f] to stop infinite evaluation must press alt+. 3 times.
how define function f in example above in such way pressing alt+. one time abort evaluation of full sequence of inputs without quitting kernel?
edit
i think if frontend creates input queue mathkernel can cancel queue.
sasha's suggestion use 4 cells valid, because that's frontend anyway, submitting several distinct evaluations kernel. if insist in using 1 cell, wrap in parens (compoundexpression), causes 4 lines treated 1 evaluation (note need ; too):
( f := checkabort[pause[.1], abort[]]; while[true, f]; while[true, f]; while[true, f] ) then, 1 abort issued abort evaluation whole.
Comments
Post a Comment