Monadic: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
(t/c)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
A function is '''monadic''' if it accepts a single arguments to the right of the function.  For example:
A function is '''monadic''' if it accepts an argument to the right of the function.  For example:


<code>'''<big>&nbsp;&nbsp;&nbsp;&nbsp;∇ z{:=}dealcard m<br/>
<code>'''<big>&nbsp;&nbsp;&nbsp;&nbsp;∇ z{:=}dealcard m<br/>
Line 7: Line 7:
In this case, the function would return a shuffle of '''m''' cards from a deck of 52.  So a statement of
In this case, the function would return a shuffle of '''m''' cards from a deck of 52.  So a statement of
: shuffle {:=} dealcard 7
: shuffle {:=} dealcard 7
Would set '''shuffle''' to the value of an array of 7 entries from the range of 1 to 52.
Would set '''shuffle''' to the value of an array of 7 entries in the range of 1 to 52. Or to visualize:<br/><br/>
<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dealcard 7<br/>
33 1 3 4 42 40 21<br/></apll>
To make this related to a deck of cards you'd have to relate the numbers to the rank and suit.


An 'argument' can be an array or string or whatever the function is willing to accept.
An 'argument' can be an array or string or whatever the function is willing to accept.


Some System functions are monadic in that you may present them one argument, and it may return a value. The [[System Function FPC|{quad}FPC]] function returns the number of digits of precision for arithmetic calculations, and you can set it to the number of digits you want.
Some System functions are monadic in that you may present them one argument, and it may return a value. The [[System Function DL|{quad}DL]] function delays execution for an amount of time indicated by the argument.
 


== See Also==
== See Also==
Line 17: Line 21:
* [[monadic]] (accepts one argument)
* [[monadic]] (accepts one argument)
* [[dyadic]] (accepts two arguments)
* [[dyadic]] (accepts two arguments)
* [[System Functions]]
<br/><hr/>
{{Article footer|0|NO}}
[[Category:Definitions]]

Latest revision as of 17:22, 13 October 2019

A function is monadic if it accepts an argument to the right of the function. For example:

    ∇ z←dealcard m
[1]    z←m ? 52
    ∇

In this case, the function would return a shuffle of m cards from a deck of 52. So a statement of

shuffle ← dealcard 7

Would set shuffle to the value of an array of 7 entries in the range of 1 to 52. Or to visualize:

      dealcard 7
33 1 3 4 42 40 21
To make this related to a deck of cards you'd have to relate the numbers to the rank and suit.

An 'argument' can be an array or string or whatever the function is willing to accept.

Some System functions are monadic in that you may present them one argument, and it may return a value. The ⎕DL function delays execution for an amount of time indicated by the argument.


See Also




See Also
System Commands System Variables and Functions Operators


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