Dyadic

From NARS2000
Revision as of 22:03, 27 February 2013 by Paul Robinson (talk | contribs) (Created page with "A '''dyadic''' function is one that takes an argument on the left and right of the function. Here is an example of a dyadic function to deal hands of cards:<br/> <apll> &...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

A dyadic function is one that takes an argument on the left and right of the function. Here is an example of a dyadic function to deal hands of cards:
    ∇ k ← count deal cards;C
[1]   c ← count
[2]   k ←''
[3]   Q:
[4]   k ← k, cards ? 52
[5]   c ← c-1
[6]   →(c>0)/Q
[7]   k←count cards ⍴ k
    ∇
So an execution of this function to deal 6 hands of 7 cards could produce the following:
      6 deal 7
 28  1  8 24 32 47 27
 38 46  1 43  3 40  7
 47 28 26  7 39  2 37
 36 12 48 46 47 31 13
 24 52 13 25 20 30 47
 23 25 43 21 15 52 14

Some system functions are dyadic,