문제

I've looked everywhere for a function to do this but given a nested vector

A←(5 3 2) (3 9 1)

I'd like to index it with B

B ← 2 1

So that for the first item in A, the 2nd item will be returned. And for the second item for A will have 3 (the first item) returned.

도움이 되었습니까?

해결책

You want the index function, applied with the each operator:

      A←(5 3 2) (3 9 1) 
      B←2 1
      B⌷¨A
3 3

Note that you should not confuse the index function with the quad function, which is a wider box.

다른 팁

You could also use "pick": B⊃¨A

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top