r1=: % : ('a' % 'b'"_)

   r1 4
0.25

   3 r1 4
|domain error: r1
|   3     r1 4
   '' r1 4
|domain error: r1
|   ''    r1 4
   4 r1 ''
|domain error: r1
|   4     r1''



----- Original Message -----
From: Kip Murray <[email protected]>
Date: Monday, March 16, 2009 15:07
Subject: Re: [Jprogramming] every box, take and ammend pattern
To: Programming forum <[email protected]>

> 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

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

Reply via email to