Dyadic

From NARS2000
Jump to: navigation, 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 named deal 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

The numbers generated would have to be related to a rank and suit to display a particular card.

Some system functions are dyadic, in that you may present them one argument on each side of the function name, and it may return a value. The ⎕FMT function provides specialized formatting when used as a dyadic function.

See Also

  • niladic (accepts no arguments)
  • monadic (accepts one argument)
  • dyadic (accepts two arguments)



See Also
System Commands System Variables and Functions Operators
Keyboard
A+S
Alt ¨ ¯ < > × ÷
Sh ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
A+S
Alt ? π
Sh Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
A+S §
Alt '
Sh A S D F G H J K L : "
Key a s d f g h j k l ; '
A+S
Alt
Sh Z X C V B N M < > ?
Key z x c v b n m , . /
NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
= < >
~ § π .. ,
/ \ ¨ .
_ ¯ Ø b e g p r v x