!7 static JTextField tf; static JTextArea textArea; static ConcurrentEvaluator currentEval; p-substance { showFrame(northAndCenter(tf = jtextfield(), textArea = jtextarea())); onEnter(tf, f update); } svoid update { if (currentEval != null) currentEval.cancelAndWait(); final new ConcurrentEvaluator eval; currentEval = eval; eval.add(func { sleepSeconds(1); print("yo"); ret "Hello 2 at " + now(); }); eval.add(func { busySleepSeconds(1); print("yo busy"); ret "Hello 3 at " + now(); }); eval.add(func { ret "Hello at " + now(); }); eval.onNewResult = r { updateResults(eval) }; eval.start(); } svoid updateResults(ConcurrentEvaluator eval) { setText(textArea, lines(allToString(notNullOnly(eval.results())))); } static int coresToUse() { ret max(1, numberOfCores()-1); }