Alex,

In fact you are right that rank can only be applied in a one-line
definition, in that the (one-line) sentence is the (only) unit of
resolution. The conjunction, Rank ("), will apply in such a sentence
to the verb to its left.

The Explicit Definition conjunction (:) used with numeric right
argument is akin to an asterisk, i.e. a note that its result is "as
follows." Taking the meaning of 3 : 0 to be
as-specified-by-the-following-lines-of-text, code can occur to the
right of that verb just like J code works to the right of any verb.
The most common purpose for code in that position is to control rank,
but there are no special rules in play here.

When I first worked with J what imagined was all wrong. The right way
to think of it is that 3 : 0 denotes an anonymous verb built from text
taken as a literal list that spans from "the next available line" to
the subsequent lone right-paren.

(Note that we may also define from a boxed list or a literal table,
and my comments were made only with literal lists in mind.)

Hope this helps!

Tracy

On Tue, Sep 1, 2009 at 2:44 PM, Alexander Mikhailov<[email protected]> wrote:
> Date: Mon, 31 Aug 2009 13:49:24 +0100
> From: Matthew Brand <[email protected]>
> Subject: Re: [Jprogramming] [Newbie question] Apply a monad to each
>    element    of an array
> To: Programming forum <[email protected]>
> Message-ID:
>    <[email protected]>
> Content-Type: text/plain; charset=UTF-8
>
> You can also define it to have that rank by default:
>
>  asd =: 3 : 0 "0
> t =. 2*(1+y)
> 1+t*(t-1)+i.4
> )
>
>   asd 1 2 3
> 13 17 21 25
> 31 37 43 49
> 57 65 73 81
>
> If you want all the numbers in one list rather than three lines then do:
> ,@:asd 1 2 3
>
> -----
>
> !!!
>
> I was searching in vain for many days how to specify rank to the verb,
> defined in multiline manner. I've searched both through JforC and LJ
> books; I was convinced that in-line setting of the rank is only possible
> for on-line definitions. I've never seen even a hint to this.
>
> ... it's still a
> pity I was in the dark for so long regarding this matter.
>
> Alex
>
>
>
>
> ----------------------------------------------------------------------
> 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