« first day (2349 days earlier)      last day (523 days later) » 

08:43
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
09:05
@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.
I'd like to concatenate

1 0 1 / 'abc' (which results in 'ac')
0 1 0 / 'abc' (which results in 'b')
1 0 0 / 'abc' (which results in 'a')

So, the three rows of 3 3⍴1 0 1 0 1 0 1 0 0 applied in turn to 'abc'.

Ravel that and you get 'acba', or something like that anyway...
I see. 'abc'[3|⍸m] should do it, where m←1 0 1 0 1 0 1 0 0.
Either way, I'd guess Replicate (/) and Where () are both O(n), so adding the extra shouldn't mess up your asmyptotics.
09:40
Thanks! I'm far from worrying about asymptotics just yet :)
@B.Wilson This seems to result in an index error, though
09:53
@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
10:15
@RubenVerg thanks, that's helpful. I still have a very hazy idea of how precedence works in APL. For all I could tell, ⍵⊢0 1 could be read as dyadic
10:32
@Schiphol Oh, ⎕IO←0 and it'll work :P Alternatively, just add 1 to the indices.
'abc'[⎕IO+3|⍸m]
10:43
@B.Wilson oh, lol, thanks!
11:36
@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)}
 
9 hours later…
20:18
@Schiphol The indexing approach is nice too, but if you wanted to use replicate you can use ⊂ on 'abc' and ¨
      ⊃,/ (1 0 1) (0 1 0) (1 0 0) /¨ ⊂'abc'
acba

« first day (2349 days earlier)      last day (523 days later) »