I agree with Fred that experimentation in this case
is asking too much. Some clarification in the documentation
would help mere mortal (MM) J users. Oleg's examples of first
defining explicit verbs with default rank and then using
f. to display their result after the rank has been explicitly
modified by applying the rank conjunction to the proverb w as
in w"1 f. is very enlightening, but MMs are going to have
difficulty even discovering that f. is required to see the fully
declared definition. But once the MM has discovered the need
for f. s/he may not see the desired readout shown by Oleg
unless s/he has requested that the display representation
is changed from the default boxed version shown next.


        w"1 f.
+-----------+-+-+
|+-+-+-----+|"|1|
||3|:|a=. 1|| | |
|| | |b=. y|| | |
|| | |a+b  || | |
|+-+-+-----+| | |
+-----------+-+-+

        The idiom Fred has asked about is so slick and
so useful, I agree that an addition to the documentation would
be appreciated by many J users.

        A related slick idiom is the definition of an anonymous verb which
is always executed in a script suggested next.

        3 : 0 ''     NB. Note the empty argument
blah blah
)

        This thread is so valuable because it clarifies that the j
expression beginning with n : 0 is a verb like any other verb
and that that verb triggers special inputs on subsequent
screen lines that are independent of other possible common
inputs (like the conjunction " or right hand arguments like '')
on the same input line with n : 0 .

        I seem to remember someone suggested that the jwiki
include an idioms section. Maybe these ideas could be placed in
such a location. I could not find a list of idioms at the jwiki except
for apl idioms.


On 8/16/06, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
Fred,

A note about novices and Dictionary: they do not
mix together well. Dictionary is the ultimate source,
but not necessarily a first, by design.

I believe that your expectation is based on an assumption
that rank is an intrinsic property of a verb and that the
rank conjunction changes that property.
That's a common pitfall, mentioned in "JfC".

The first part is true, but the second is not.
Rank conjunction does not "attach a new rank" or
"modify the rank property", it's just an ordinary
conjunction, the same as you would say

   u=. 3 : 'y+1'&.>
   u i.3
+-+-+-+
|1|2|3|
+-+-+-+

So it's not about ranks and explicit definitions,
it's about conjuntions and verbs and the rules using
explicit script (the : 0), which parses up to ending ")".

To discover how would that work even if you don't
have a dictionary, which is better, you can use the
interactive mode and facilities f. (fix) dereferencing names
and b. for rank.

   v=: 3 : 'y+1'

   v"1 f.
3 : 'y+1'"1    NB. so that's how to write a one-liner with rank

   3 : 'y+1' b. 0  NB. rank of explicit verbs is infinite
_ _ _

   w=: 3 : 0
a=. 1
b=. y
a+b
)
   w"1 f.      NB. so that's how to write explicit with rank
3 : 0"1
a=. 1
b=. y
a+b
)

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

Reply via email to