In a lot of respects, enclose (as defined by me) would function like nested C structures. C structures have proven their value tremendously. Each enclose would essentially create a new structure with the thing it encloses as an element of the new structure. Structures containing scalars or arrays function utterly the same.
Blake On Mon, May 12, 2014 at 10:35 AM, Elias Mårtenson <loke...@gmail.com> wrote: > Well, APL doesn't have pointers. :-) (which is something I miss indeed) > > Regards, > Elias > > > On 12 May 2014 23:34, Blake McBride <blake1...@gmail.com> wrote: > >> First, as I said before, you can rationalize anything. Calling it "turn >> into a scalar" rather then "add a layer of boxing" is a prime example, and >> the case in point. >> >> The C language has pointers. You can have a pointer to a pointer. You >> can also have a pointer to a pointer to a pointer, etc.. Each pointer is >> an additional level of indirection. The values don't change. You can >> indirect or de-reference to your heart's delight. I don't know why you >> would have a problem with a boxed (one level of indirection) to a scalar. >> It is useful as hell in C, and it could be in APL too. >> >> Blake >> >> >> On Mon, May 12, 2014 at 10:27 AM, Elias Mårtenson <loke...@gmail.com>wrote: >> >>> Well, the enclose function's role is not to "add a layer of boxing". Its >>> role is to "ensure the argument is a scalar". If the argument is already a >>> scalar, it doesn't have to do anything. >>> >>> I'm not even sure it's possible to have a scalar enclosing another >>> scalar. For all intents and purposes a double-layers scalar would behave >>> indistinguishably from a plain scalar anyway. >>> >>> Regards, >>> Elias >>> >>> >>> On 12 May 2014 23:19, Blake McBride <blake1...@gmail.com> wrote: >>> >>>> If that is true, I can sure live with and respect that. What would the >>>> idiom be to have enclose do nothing but add a single layer of boxing to ANY >>>> data? What would the idiom be to have disclose do nothing more than remove >>>> a single layer of a single boxed item? (Both without making any >>>> modifications to the data, and never combining them.) >>>> >>>> If I know the answer to those, I could do a lot with it. >>>> >>>> Thanks. >>>> >>>> Blake >>>> >>>> >>>> >>>> On Mon, May 12, 2014 at 10:09 AM, Juergen Sauermann < >>>> juergen.sauerm...@t-online.de> wrote: >>>> >>>>> Hi Blake, >>>>> >>>>> maybe what you are after is ⊃¨ instead of ⊃: >>>>> >>>>> ⊃'333' '55555' >>>>> >>>>> 333 >>>>> 55555 >>>>> >>>>> ⊃¨'333' '55555' >>>>> 333 55555 >>>>> >>>>> I guess they thought 'why do something that already exists by other >>>>> means (ie. ⊃¨) and do something different (ie. ⊃) >>>>> that could be useful elsewhere'. >>>>> >>>>> /// Jürgen >>>>> >>>>> >>>>> >>>>> On 05/12/2014 04:43 PM, Blake McBride wrote: >>>>> >>>>> Thanks. I have to say, with no reflection on present company, I am >>>>> about as frustrated and disgusted with nested arrays, as defined by IBM, >>>>> as >>>>> I could be. Having enclose do one thing for all arrays and another for >>>>> scalars has caused me endless hours of frustration. (Isn't a scalar just >>>>> a >>>>> zero dimension array?) How much time has one to spend making enclose do >>>>> what comes naturally to ones mind? Now I find that disclose actually >>>>> modifies data beyond the ability to reconstruct it. In your example, if >>>>> one string were a different length than the other, APL will lengthen it to >>>>> match the longest upon disclose. The original length of each string is >>>>> lost forever. Why stop there? Why not change a 4 to a 7? >>>>> >>>>> Having enclose and disclose uniformly add and remove layers of >>>>> boxing only is simple, consistent, predictable, useful, and easy to >>>>> understand. If I add 3 and then subtract 3 I end up with the same number. >>>>> But if I enclose and then disclose, I end up with something different - >>>>> sometimes. Imagine that! >>>>> >>>>> '333' '55555' >>>>> ┌→────────────┐ >>>>> │┌→──┐ ┌→────┐│ >>>>> ││333│ │55555││ >>>>> │└───┘ └─────┘│ >>>>> └∊────────────┘ >>>>> ⊃'333' '55555' >>>>> ┌→────┐ >>>>> ↓333 │ >>>>> │55555│ >>>>> └─────┘ >>>>> (⊃'333' '55555')[1;] >>>>> ┌→────┐ >>>>> │333 │ >>>>> └─────┘ >>>>> ⍴(⊃'333' '55555')[1;] >>>>> ┌→┐ >>>>> │5│ >>>>> └─┘ >>>>> >>>>> >>>>> There are ways to rationalize almost anything. IMO, the IBM nested >>>>> array approach is confusing, unpredictable, and renders it a tool of very >>>>> careful last resort. >>>>> >>>>> I know there has been debate about this in the past, and I am not >>>>> looking to resurrect it. It is a real shame IBM chose the path it chose. >>>>> >>>>> Blake >>>>> >>>>> >>>>> >>>>> On Mon, May 12, 2014 at 5:08 AM, Jay Foad <jay.f...@gmail.com> wrote: >>>>> >>>>>> APL2's Disclose (Dyalog calls it Mix) will convert a vector of vectors >>>>>> into a matrix: >>>>>> >>>>>> ⊃'timor' 'mortis' >>>>>> ┌→─────┐ >>>>>> ↓timor │ >>>>>> │mortis│ >>>>>> └──────┘ >>>>>> >>>>>> Your second application of Disclose is applied to a 1-vector of >>>>>> 1-vectors (,⊂,7), so it returns a 1x1 matrix. >>>>>> >>>>>> Jay. >>>>>> >>>>>> On 12 May 2014 06:03, Blake McBride <blake1...@gmail.com> wrote: >>>>>> > ⊃⊃⊂,⊂,7 >>>>>> > ┌→┐ >>>>>> > ↓7│ >>>>>> > └─┘ >>>>>> > ⍴⊃⊃⊂,⊂,7 >>>>>> > ┌→──┐ >>>>>> > │1 1│ >>>>>> > └───┘ >>>>>> > >>>>>> >>>>> >>>>> >>>>> >>>> >>> >> >