What is the right way to make replicate "broadcast"? I'd like something like
,3 3⍴1 0 1 0 1 0 1 0 0 / 'abc'
somehow to result in 'acba'
@RubenVerg Thanks! I need to think more about how this works. In particular, I'm puzzled by right tack. By reading the documentation one would think it just outputs 0 1 every time
@Schiphol What do you mean by "broadcast"? Maybe a more complete description/example would help? Pretty sure you don't just want 'abc'[1 3 2 1] or whatever.
@Schiphol the right track here is just so that 0 1 doesn't become part of the right operand to Power, you could just wrap everything else in brackets instead
note that here Right is monadic, because the "left argument" is a function and is not considered part of the call
just noticed, my code is missing a disclose before the inner dfn begins
@Schiphol operators try to bind everything to their left but as few as possible to their right, so like {1+⍵}⍣2×2 parses as ({1+⍵}⍣2)×2 and not as {1+⍵}⍣(2×2). however, stranding (ie creating arrays by juxtaposition) has higher precedence and so {1+⍵}⍣2 2 parses as {1+⍵}⍣(2 2) and not as ({1+⍵}⍣2)2
so it is common to use ⊢ after operators to avoid stranding and instead switch from the operand context to the argument context
my code, {⊃{⌽+\⍵}⍣⍵⊢0 1}, parses as {⊃(({⌽+\⍵}⍣⍵)(⊢0 1)}