Hacker News new | ask | show | jobs
by dmitriz 2346 days ago
> v: 3 4 /a vector, i.e. a list of 2 atoms.

> v+'v /v plus EACH v, i.e. (3+3;4+4).

> 6 8

How is for EACH working here? Adding v (a 2-vector) to each element gives a 2-vector, so why isn't the result a 2-vector of 2-vectors?

1 comments

It applies element-wise across both arrays. What you're describing is more like an each-right (+/:) or each-left (+\:).

    2019-09-25 14:44:44 2core 3gb avx2 © shakti l test
     v:3 4
     v+v
    6 8
     v+'v
    6 8
     +'[v;v]
    6 8
     v+/:v
    6 7
    7 8
    
     +/:[v;v]
    6 7
    7 8
Indeed, that was my confusion, thanks!