Confusing hyperblock behavior

untitled script pic
i would expect this to do:

(
    (.1, .2) + 1,
    .3 + (2, 3)
)

giving ((1.1, 1.2), (2.3, 3.3))
but it gives ((1.1, (2.2, 3.2)), (1.3, (2.3, 3.3)))

why does this happen? i read the manual and see no example of this case. it looks suspiciously like a bug. (swapping the lists being added doesn't change the result, so there's at least that)

I see what is happening. It's adding the first item of the left side to the right side, then it adds the second item of the left side to the right side.
Here's the result

is this behavior intended?

I personally don't think so, since it would make more sense to add the first item of left to the first item of right, and the second item of left to the second item of right, regardless of the value.

Well, APL agrees with you guys:

      (⊂(⊂ .1 .2) .3) + (⊂ 1 (⊂ 2 3))
   1.1 1.2    2.3 3.3   

(The horseshoe is the "enclose" function, which makes its inputs into a single atom with respect to an enclosing array. APL expects its arrays to have simple dimensions.)

I don't know whether Jens thought it out or whether it just happens to work this way.

hyperblocks are for arrays with same dimensions

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.