🔍

Polyadic spawn

Schedules lambda to run on some free scheduler. Rеturns a join handle.

Syntax: spawn[<x>〔; <y>〔; .. 〕〕]

Whеre:

  • x is a lambda to be run;
  • y, .. are optional arguments.

o)spawn[{0N!(,':x)};!10]
<Reagent#4>
0 0N
1 0
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
o)

Rеturned handle is the reagent. You can create reactions with it, apply a get to it for synchronization or to get results. You can send a signal to the reagent that will stop lambdas and be its result.

o)h: spawn {100000{x+1}/1; "done"}
<Reagent#4>
o)get h
"done"
o)

o)h: spawn {{x+1}/1; "done"};
o)h["killed"]
o)get h
"killed"