diff options
Diffstat (limited to 'demos/chain.apl')
-rw-r--r-- | demos/chain.apl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/demos/chain.apl b/demos/chain.apl new file mode 100644 index 0000000..e7e1979 --- /dev/null +++ b/demos/chain.apl @@ -0,0 +1,18 @@ +⍝ First we define a function which recieves a message, +⍝ and sends one to the task with id ⍵ +f←{ + (from msg)←{1 ⍵}⍇⍬ + (1+msg)⍈⍵ + } + +⍝ Now start 10000 of those +last←f&'chain'⍣10000⊢⎕self + +≢⎕THREADS 0 + +⍝ Start the chain by sending something to the last one +0 ⍈ last + +⎕threads 0 1 2 + +{1 (2⊃⍵)}⍇0 ⍝ We only pick out the message part, not the sender |