And tacit definitions can be made monadic only by appending : [: as in

   r =: % : [:  NB. reciprocal

   r 4
0.25

   2 r 4
|domain error: r
|   2     r 4

   2 % 4
0.5

Kip Murray

Tracy Harms wrote:
During my trials, I had it locked in my head that '[: is a suicide verb...
so how do I force a verb to be monadic'.

Steven,

If this was a question, note the last part of the Dictionary listing
for Explicit Definition:

The definitions of the monadic and dyadic cases produced by 3 : 0 are
separated by a colon on a line by itself; if none occurs, the domain
of the dyadic case is empty.

As an example:

   squareroot=: 3 : '%:y'

   squareroot 2
1.41421
   4 squareroot 2
|domain error: squareroot
|   4     squareroot 2


Tracy
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to