🔍

Monadic/Dyadic get

Get data from reagent.

Syntax: get <x>; get[<x>]; get[<t>; <x>]

Whеre x - reagent, t - timeout in milliseconds.

get will waiting for data and without t can lock the task.

o)r:reagent[`async];
o)//for example, another task sends data to reagent r
o)spawn {r[1]; r[2]};
o)get r
1
o)get[100;r]
2
o)get[100;r]
** runtime error: `get`:
timeout elapsed
o)//Using trap you can catch timeout error
o)@[get[100;];r;{x`message}]
"timeout elapsed"
o)

Do not use get after react for the same reagent. react will capture all data and get will lock the task.