bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] APL fill elements


From: Juergen Sauermann
Subject: Re: [Bug-apl] APL fill elements
Date: Sun, 10 Aug 2014 14:28:59 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

Hi Peter,

no there isn't. Fill items and Fill functions occur all over the place in APL2.
And they are function specific so that ↑ has other fill items (' ' and 0) than
+ (0) and × (1). On the other hand fill items are not at all related ⎕IO.

You can easily achieve what you are after like this:

      A←4 5
      B←3 2⍴42
      Z←A↑B
      Z
42 42 0 0 0
42 42 0 0 0
42 42 0 0 0
 0  0 0 0 0
      Z + ∼A↑(⍴B)⍴1
42 42 1 1 1
42 42 1 1 1
42 42 1 1 1
 1  1 1 1 1


/// Jürgen


On 08/09/2014 08:15 PM, Peter Teeson wrote:
Is there a nice way to set the fill element for arrays?
Right now it's 0 for numeric and ' ' for character.

Because my function, that is deliberately ⎕IO agnostic, produces an m by n array of different length vectors as a result of using X←(⊂matrix)foo¨matrix. These vectors are certain indices into the original matrix This is precisely what I want.

However in ⊃X each vector is filled with 0 - which, when ⎕IO is also 0, is also a legitimate index. And I don't want that. 

I suppose I could set ⎕IO locally but it doesn't appeal to my sense of elegance - although it would be practical! Sigh!

So it would be nice to allow me to set the fill element to something other than the default values.

Comments?

respect….

Peter





reply via email to

[Prev in Thread] Current Thread [Next in Thread]