Here is a utility which shows how J parcels arguments:

aRgs=:1 :0
  YRank=. #$y
  URank=. 0 >. YRank (] + [ * ] < 0:) {. u b. 0
  ,: URank (}.;{.) $y
:
  XRank=. #$x
  YRank=. #$y
  URank=. 0 >. (XRank,YRank) (] + [ * ] < 0:) }. u b. 0
  (({.URank) (}.;{.) $x) ,: ({:URank) (}.;{.) $y
)

Example use:

  1 + 1 2 3
2 3 4

  1 + aRgs 1 2 3
+-++
| ||
+-++
|3||
+-++

The rows here represent the structure of the x and y arguments.  The
first column is the shape of the "frame".  The second column is the
shape of the "cells".

If these concepts are unfamiliar, please review one or more references
on the subject.  For example:

http://www.jsoftware.com/help/primer/frame_and_cell.htm
http://www.jsoftware.com/help/dictionary/dicta.htm
http://www.jsoftware.com/help/dictionary/dictb.htm
http://www.jsoftware.com/papers/rank1.htm

Generally speaking, however, the frames must agree (one must be a
prefix of the other) and the interpretation of the cells depends on
the verb being used.

Here is the example you were asking about:

  d=:6 _5 7 3

  r=: <./, >./

  (-i.10) < aRgs 1 {. r d
+--++
|10||
+--++
|1 ||
+--++

You can see here that the frames do not agree.

--
Raul

P.S. I sometimes have a problem where my mail client removes line ends
from my message.  I believe I have averted that problem.  However I
cannot test that this is the case except by sending the email message.
 I the above message is garbled, you have my apologies.

P.P.S. I am experimenting with a naming convention where the case of
the first two letters of a user defined name depend on the syntactic
type of that name:  NOUN, Adverb, cONJUNCTION, verb

On Fri, Dec 23, 2011 at 2:41 AM, Linda Alvord <lindaalv...@verizon.net> wrote:
>
>   d=:6 _5 7 3
>   r=: 13 :'(<./y),>./y'
>   r
> <./ , >./
>   r d
> _5 7
>  (-i.10)
> 0 _1 _2 _3 _4 _5 _6 _7 _8 _9
>  1{.r d
> _5
>  (-i.10)<_5
> 0 0 0 0 0 0 1 1 1 1
>
>   (-i.10)<1{.r d
> |length error
> |   (-i.10)    <1{.r d
>
>   (-i.10)<(1{.r d)
> |length error
> |   (-i.10)    <(1{.r d)
>
>   I want something like this, but this is a simple example of what doesn't
> work.
>
> Linda
>
> ----------------------------------------------------------------------
> 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