The only "anomaly" here is the notation for 
one-element list constants, where
   4-element list      1 2 3 4
   3-element list      1 2 3
   2-element list      1 2
   1-element list      impossible

For a one element list, constants are not possible 
and you have to say things like ,1 or 1$1 or some
other expression.  But it is preferable to have 1
denote an atom.

Regarding q: itself, since the dyad q: has ranks
0 0, the behaviour of x q: y for general x and y 
is completely specified by the behaviour for atoms 
x and y.  The dictionary says:

 If x is positive and finite, x q: y is the 
 list of exponents in the prime decomposition 
 of positive integer y, based upon the first 
 x primes; if x is _ , a sufficient number of 
 primes is used.

Note the word LIST.  1 is positive and finite, so 
the result of 1 q: y should be a list when y is an 
atom, and so for general y the shape of 1 q: y
should be ($y),1 .

There are several functions where one of the 
arguments becomes part of the shape of the result. 
For example:

   $ 5 # 12
5
   $ 5 2 {. 'abc',:'efg'
5 2
   $ i.5 4
5 4
   $ 5 ? 12
5
   $ 1$. 5 4
5 4



----- Original Message -----
From: "R.E. Boss" <[EMAIL PROTECTED]>
Date: Saturday, February 17, 2007 5:34 am
Subject: RE: [Jgeneral] Shape of 1&q:

> This (kind of) anomalies are not unusual in J:
>   $&.> 1; 1 2; 1 2 3; 1 2 3 4; 1 2 3 4 5
> ++-+-+-+-+
> ||2|3|4|5|
> ++-+-+-+-+
> 
> and so
>   $@(5&q:)&.> 1; 1 2; 1 2 3; 1 2 3 4; 1 2 3 4 5
> +-+---+---+---+---+
> |5|2 5|3 5|4 5|5 5|
> +-+---+---+---+---+
> 
> Based on this, you could also state 
>   $@(q:&y)&.> y=:1 2 3 4 5
> +---+---+---+---+---+
> |5 1|5 2|5 3|5 4|5 5|
> +---+---+---+---+---+
> 
> is an anomaly.
> 
>   $@(q:&y)&.> y=:1 2 3 4 5
> +-+---+---+---+---+
> |5|5 2|5 3|5 4|5 5|
> +-+---+---+---+---+
> 
> should considered to be (more) consistent.
> 
> 
> As it is now ($ x q: y) -: ($ y),x
> What other examples exist, apart from the trivial one $ itself, 
> where one of
> the parameters becomes part of the shape of the result?
> 
> 
> I could not detect where ,5 is not consistent with the dictionary. 
> 
> 
> R.E. Boss
> 
> 
> 
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:general-
> [EMAIL PROTECTED] Roger Hui
> Verzonden: dinsdag 13 februari 2007 0:28
> Aan: General forum
> Onderwerp: Re: [Jgeneral] Shape of 1&q:
> 
> A result shape of 5 1 in that case is consistent 
> with the specifications in the dictionary but 
> one of ,5 is not.
> 
> Also:
>   y=: >: i.5
>   $@(q:&y)&.> 1 2 3 4 5 6
> +---+---+---+---+---+---+
> |5 1|5 2|5 3|5 4|5 5|5 6|
> +---+---+---+---+---+---+
> 
> Making the first one ,5 instead of 5 1 would be
> anomalous.  
> 
> 
> 
> ----- Original Message -----
> From: "R.E. Boss" <[EMAIL PROTECTED]>
> Date: Monday, February 12, 2007 1:37 pm
> Subject: [Jgeneral] Shape of 1&q:
> 
> >   $2 q: >:i.5
> > 5 2
> > 
> > seems reasonable, but why is 
> >
> >   $1 q: >:i.5
> > 5 1
> >
> > and not just 5?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to