[Jprogramming] Head, (Behead, ) Open to get an array produces surprise lead unit axis
Henry Rich
henryhrich at gmail.com
Sun Mar 24 15:06:21 UTC 2019
}. d is a singleton list, and its shape is the frame of > . If you know
you want only the second atom, use 1 { d.
1 {:: d is the fastest way to open the second box of d, and ((1;0) {::
d) the fastest way to do what you want here.
On 3/24/2019 10:50 AM, Brian Schott wrote:
> I want the first result below to be (shape) 3 2 6, not 1 3 2 6 .
> I am surprised because the last result below shows that the leaf I desire
> has the desired shape, 3 2 6.
>
> Short of using Takes instead of the Head, I would like to produce the
> desired result by only messing with the middle tine in the fork. That is,
> in `b ([ (xxx) }.@])d`, I want only the xxx=:>@{.@>@] )}.@] altered.
>
> Can you explain or remedy the problem?
>
> (NB. line wrap problem below)
>
> $b([(>@{.@>@] )}.@]) d
> 1 3 2 6
> d
> ┌─────────────┬─────────────────────────────┐
> │┌─────┬─────┐│┌──────────────────┬────────┐│
> ││10 8│10 10│││ 7 _8 _4 _8 1 1│10 10 10││
> ││ 1 _7│ │││_8 1 8 _10 _7 _2│ ││
> ││ │ │││ │ ││
> ││ 2 _7│ │││ 5 _5 3 2 1 2│ ││
> ││_1 10│ │││_7 _4 _1 _2 _2 _1│ ││
> │└─────┴─────┘││ │ ││
> │ ││_9 _8 8 9 3 _5│ ││
> │ ││_4 _2 7 7 5 _2│ ││
> │ │└──────────────────┴────────┘│
> └─────────────┴─────────────────────────────┘
> 5!:5<'d'
> (<(2 2 2$10 8 1 _7 2 _7 _1 10);10 10),<(3 2 6$7 _8 _4 _8 1 1 _8 1 8 _10 _7
> _2 5 _5 3 2 1 2 _7 _4 _1 _2 _2 _1 _9 _8 8 9 3 _5 _4 _2 7 7 5 _2);10 10 10
> $L: 0 d
> ┌─────────┬─────────┐
> │┌─────┬─┐│┌─────┬─┐│
> ││2 2 2│2│││3 2 6│3││
> │└─────┴─┘│└─────┴─┘│
> └─────────┴─────────┘
>
>
---
This email has been checked for viruses by AVG.
https://www.avg.com
More information about the Programming
mailing list