Hi,

yes, thanks.

I believe 4 ⎕CR tells the difference:

      4 ⎕CR 5
┏━┓
┃5┃
┗━┛
      4 ⎕CR ,5
┏→┓
┃5┃
┗━┛


In GNU APL the difference between e.g. '5' and "5" is on purpose because  the fact
that '5' is a scalar and '55' is a vector can sometimes be quite annoying, and was one
of the reasons for introducing "" in addition to ''. Another reason was support for ASCII
control characters like \n  in APL literals.

/// Jürgen


On 09/20/2015 11:15 PM, Kacper Gutowski wrote:
On Sun, Sep 20, 2015 at 9:57 PM,  <alexwei...@alexweiner.com> wrote:
Should the execute primitive include the structure data? I thought that the
phrase in the subject line would return zero. I thought the first element
would return a scalar 5, and the second would return a single element five.
Both evaluate to a scalar five.
In some places single-element vectors and scalars are treated equally.
That's why ⍎'5' is even allowed in the first place.  ⍎ throws domain
error if its argument has rank higher than one, but otherwise it doesn't
care and executes ravel list of its argument as a single line regardless
if it's a vector or scalar.

It's always a line of APL program, not data with any kind of structure.
And by the rules of APL language, a program consisting of single digit 5
has scalar result.  It is still so if you were to put, for example, a
space before or after it (necessarily making the code itself a vector;
but without changing the result it evaluates to).

Distinction between kind of quotes used would matter if they were the
part of the line executed by ⍎:

      ≡/⍎¨'"5"' "'5'"
0

Here "5" and '5' are executed giving a (character) vector and a scalar,
respectively, in the result.

-k



Reply via email to