Thanks Don, That explains why [: is there. But it doesn't help explain the
4: in Josephus2.
Jos=:[: : ((1 }. ] |.~ [: <: [)^:(1 < [: # ])^:_ [:i. ])
4 Jos 38
37
Jos 12
|domain error: Jos
| Jos 12
Adding the [: must only be required for tacit dyadic verbs.
Josephus4 =: 13 :'[:(|x+)/i.->:y'
4 Josephus2 38
37
Josephus2 12
|domain error: Josephus2
| Josephus2 12
Jos
[: :((1 }. ] |.~ [: <: [)^:(1 < [: # ])^:_ ([: i. ]))
Josephus2
4 : '(|x&+)/i.->:y'
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected] software.com] On Behalf Of Don Guinn
Sent: Thursday, May 09, 2013 9:57 AM
To: Programming forum
Subject: Re: [Jprogramming] rosettacode
I
f you want to define a tacit definition as monadic or dyadic only, simply use
[: for that part of the definition. The definition I had for Jos was yours but
with [: for the modadic use to make it give an error when used monadically
instead of returning a nonsense result.
On Thu, May 9, 2013 at 7:23 AM, Linda Alvord <[email protected]>wrote:
> Here is the definition I was using:
>
> Jos=:(1 }. ] |.~ [: <: [)^:(1 < [: # ])^:_ [: i. ]
> Jos 12
> 10
> 4 Jos 38
> 37
>
> Linda
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Don
> Guinn
> Sent: Thursday, May 09, 2013 8:11 AM
> To: Programming forum
> Subject: Re: [Jprogramming] rosettacode
>
> Jos=:[: : ((1 }. ] |.~ [: <: [)^:(1 < [: # ])^:_ [: i. ])
>
> Jos 12
>
> |domain error: Jos
>
> | Jos 12
>
>
>
> On Thu, May 9, 2013 at 1:11 AM, Linda Alvord <[email protected]
> >wrote:
>
> > Marc, your reference was helpful.
> >
> > Jos=:(1 }. ] |.~ [: <: [)^:(1 < [: # ])^:_ [: i. ]
> > Josephus2 =: 4 :'(|x&+)/i.->:y'
> >
> > The 4 indicates a dyad function only:
> >
> > Jos 12
> > 10
> > Josephus2 12
> > |domain error: Josephus2
> > | Josephus2 12
> >
> >
> > Jos allows a monadic result, but I have no idea of its meaning.
> > Josephus does not allow a monadic use.
> >
> > Thanks. Linda
> >
> >
> >
> > On Wed, May 8, 2013 at 8:27 AM, Linda Alvord
> > <[email protected]
> > >wrote:
> >
> > > Since both verbs are dyadic, what is the meaning of 4 : in
> > > Josephus2
> ?
> >
> >
> > I'm not sure I understand your question-you defined Josephus2 as a
> > dyadic verb.
> >
> > ':' is the explicit definition conjunction (m : n). Where the left
> > argument 'm' is 4, a dyadic verb is produced; 'n' is the body of the
> > verb. (See
> > http://www.jsoftware.com/help/dictionary/d310n.htm.)
> >
> > Best,
> > Marc
> > --------------------------------------------------------------------
> > -- For information about J forums see
> > http://www.jsoftware.com/forums.htm
> >
> > --------------------------------------------------------------------
> > -- For information about J forums see
> > http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm