>>
<<
Usr
Pri
JfC
LJ
Phr
Dic
Voc
!:
Help
Primer
Monad and dyad definition
As discussed in the earlier section on ambivalence, all verbs had two definitions, a monad and a dyad. You have defined only a monad for centigrade. What about the dyad?
23 centigrade 32
|domain error
| 23 centigrade 32
Since you didn't provide a dyad definition, it is empty and this is treated as if the dyad had no arguments in its domain, and any arguments you give will cause a domain error.
Let's examine some simple examples of defining dyadic, monadic, and both cases.
monadminus =. 3 : 0
- y
)
monadminus 5
_5
5 monadminus 3
|domain error
| 5 monadminus 3
The above defines the monad of the verb named monadminus. Applying it monadically works and applying it dyadically fails.
In one-line definitions like this you can take a shortcut and make the definition on a single line and avoid entering the special input mode that needs to be ended with the ). The following is an equivalent way of doing the above definition:
monadminus =. 3 : '- y'
The string contains the single line that makes up the definition. It is provided directly as the right argument of : instead of the 0 used earlier.
So far you have defined just the monadic case of a verb. You can also define a verb with just a dyadic definition. Instead of 3 as the left argument to : use a 4 to define the dyadic case.
dyadminus =. 4 : 'x - y'
5 dyadminus 3
2
dyadminus 5
|domain error
| dyadminus 5
In the monad case the y name is the right argument and in the dyad case x is the left argument and y is the right.
What if you want to define both cases of a verb?
minus =. 3 : 0
- y
:
x - y
)
The : by itself on a line separates the monad and dyad definitions.
3 minus 5
_2
5 minus 3
2
minus 5
_5
>>
<<
Usr
Pri
JfC
LJ
Phr
Dic
Voc
!:
Help
Primer