Fwd: Definition of "first-thingy"

2020-02-20 Thread Elias Mårtenson
-- Forwarded message -
From: Elias Mårtenson 
Date: Thu, 20 Feb 2020, 22:39
Subject: Definition of "first-thingy"
To: 


One benefit of experimenting with low-level PAL behaviours is that I've
spent much more time lately reading the ISO spec.

I was reading the specification for ↑ (first), which says that it returns
"first-thingy" of the argument.

Now, the definitions section defines "first-thingy" as such:






*First-thingy in A : An opration that for A , an array, returns an array B
, defined as follows:If A is empty, set B1 to the typical-element of A
.Otherwise, set B1 to the first-item of the ravel-list of A .If B1 is a
number or a character, set B to an array, whose ravel-list contains the
singleitem B1 , and whose shape-list is empty.Otherwise, set B to B1 .*

My impression from reading this is that this is not consistent with GNU
APL's behaviour in the following case: ↑9

GNU APL returns the number 9 in this case, while it would seem it's
supposed to return a 9 wrapped in a zero-dimensional array: ⊂9

Now, GNU APL evaluates ⊂9 to the number 9 as well, which I also feel isn't
consistent.

Am I misreading the spec, or is there an inconsistency here?

Regards,
Elias


Re: Fwd: Definition of "first-thingy"

2020-02-20 Thread Dr . Jürgen Sauermann

  
  
Hi Elias,
  
  I believe "zero-dimensional array" is a synonym for "scalar" (or:
  an array
  with: 0=⍴⍴Z.
  
  It is not an empty array. Also in IBM APL2 enclosing a scalar,
  like in ⊂9,
  is that same scalar and not a nested value.
  
  Best Rewgards,
  Jürgen
  

On 2/20/20 4:11 PM, Elias Mårtenson
  wrote:


  
  
  
-- Forwarded message
  -
  From: Elias
Mårtenson 
  Date: Thu, 20 Feb 2020, 22:39
  Subject: Definition of "first-thingy"
  To: 




  One benefit of experimenting with low-level PAL
behaviours is that I've spent much more time lately reading
the ISO spec.
  
  
  I was reading the specification for ↑ (first), which says
that it returns "first-thingy" of the argument.
  
  
  Now, the definitions section defines "first-thingy" as
such:
  
  
  First-thingy in A : An opration that for A , an array,
  returns an array B , defined as follows:
  If A is empty, set B1 to the typical-element of A .
  Otherwise, set B1 to the first-item of the ravel-list of A
  .
  If B1 is a number or a character, set B to an array, whose
  ravel-list contains the single
  item B1 , and whose shape-list is empty.
  Otherwise, set B to B1 .
  
  
  My impression from reading this is that this is not
consistent with GNU APL's behaviour in the following case:
↑9
  
  
  GNU APL returns the number 9 in this case, while it would
seem it's supposed to return a 9 wrapped in a
zero-dimensional array: ⊂9
  
  
  Now, GNU APL evaluates ⊂9 to the number 9 as well, which
I also feel isn't consistent.
  
  
  Am I misreading the spec, or is there an inconsistency
here?
  
  
  Regards,
  Elias