« first day (1896 days earlier)      last day (775 days later) » 

1:23 AM
@LdBeth - If I’m understanding right there are chromograms without colorings. E.g. [ - ]0 since the bitwise sum of the counts can’t be zero.
 
1:47 AM
@doug <s> 2 1 3 fits this, and ⋄ ≠/2 2⊤2 1 3 </s> well yes this cannot be filled.
 
@LdBeth 0 0
 
 
3 hours later…
4:51 AM
@LdBeth ⍤0⊢ does nothing there.
 
hmm, so the rank operator try to just call buildin functions when possible?
 
Yes, but with some additional checking.
 
5:33 AM
@Adám - I think
Whoops.. @Adám I think @LdBeth knew the result would be the same. Are you saying the same exact implementation will be used?
I.e. as if the rank operator simply gets ignored here.
(FWIW, I can’t edit posts on my mobile)
 
@doug Exactly the same:
      ]runtime -c +⍨⍤0⍳1e6 +⍨⍳1e6

  +⍨⍤0⍳1e6 → 6.6E¯4 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  +⍨⍳1e6   → 6.7E¯4 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
att
6:12 AM
why does {⎕←⍵}¨⍬ print 0?
 
because prototypes
dyalog wants to know what types of elements your array contains, so it must see what type of thing {⎕←⍵} returns
      ⍬ ≡ ⍬
1
      '' ≡ ⍬
0
      ⍬ ≡ {⎕←⍵}⍬

1
      '' ≡ {⎕←⍵}⍬

0
(but yes that's very annoying when doing anything with side-effects, including printing; and even sometimes when not, as the code may error when given something it didn't expect)
 
 
3 hours later…
9:22 AM
Interesting, though on an example this size I’m not sure I’d expect a difference in performance.
@Adám ^^. This was meant as a reply.
 
@doug Oh, much less than that will do:
      ]runtime -c +⍨⍤0⍳1e3 +⍨⍳1e3 +∘⊢⍨⍤0⍳1e3 +∘⊢⍨⍳1e3

  +⍨⍤0⍳1e3   → 9.0E¯7 |      0%
  +⍨⍳1e3     → 6.4E¯7 |    -29%
  +∘⊢⍨⍤0⍳1e3 → 1.2E¯4 | +13113% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  +∘⊢⍨⍳1e3   → 9.8E¯7 |     +8%
 
9:42 AM
Hmm.. Doesn’t that suggest they’re not doing the exact same thing? I thought the point above was to demonstrate a different way to get the same result which iterated through the left and right vector differently.
 
@doug It does in principle, but recognises certain operands, and takes shortcuts.
 
10:07 AM
Got it. Thanks.
 
 
1 hour later…
11:26 AM
CMP: Should I add {⍺←⊢ ⋄ ⍺(⍺⍺⊣⊢)⍵} to APLcart for a way to either apply the operand (if it is a function) use is as constant function (if it is an array)? Or maybe just f⊣⊢ as a construct? If yes, the issue arises of how to denote a variable-type operand.
 
12:06 PM
Hi, I was having a try at this code golf problem 'Remove unmatched brackets': https://codegolf.stackexchange.com/questions/245625/remove-unmatched-brackets
I know the classic 'check if brackets are matched' has a nice APL solution but the additional complication of needing to remove the unmatched brackets has me struggling.

In a non-array language I would do this with a stack and push/pop elements. Is this a problem where it looks like it's necessary to use recursion ∇? Or is there probably a nice non-recursive array solution I haven't found yet?
(Looks like this is the second time the topic of bracket matching for a code golf problem has come up today! Different problems fortunately.)
 
12:46 PM
I'm off now but I'll check back tomorrow so if anyone has suggestions they'd be very welcome! Thanks!
 
 
2 hours later…
2:24 PM
@andycraig There's a simple solution using repeated regex… '\[|]' '<' '>'⎕R'' '[' ']'('\[([^][]*)\]'⎕R'<\1>'⍣≡)
But in general, I think such problems require a state machine. You can traverse and update a state with {state←initial_value ⋄ expression state⊣{traverser}¨⍵}
 
 
2 hours later…
```
{⍵=⍬:⍬ ⋄ (¯1↑⍵), ∇ ¯1↓⍵} '123'
LENGTH ERROR: Mismatched left and right argument shapes
```

I don't understand why I am getting this error. What am I doing wrong?
 
@GreenSaguaro = compares element-by-element, but has 3 while has 0.
 
@Adám Ah OK! Let me try.
Yep, that was the problem. Thank you!
 
You might want to look at but note that is not the same as ''.
Maybe a better test is 0=≢⍵
 
 
6 hours later…
10:07 PM
@andycraig Some variant of +\-⌿↑1 2=⊂'[]'⍳'[xyz]]abc[[def]hij[' is the classic way to find matched parentheses in array languages. Numbers at the same level match. Negative numbers mismatch. The trouble is your frame of reference gets thrown off by a mismatched parenthesis. The most straightforward way to deal with that is to iterate.
 
10:21 PM
Is it possible to do an inline filter? Say that I have something like {(↑Value=SegSums[⍵])/↑Segs[⍵]}¨EachIndex. I want to just prepend this with a filter to remove the empty results rather than saving it into a variable then filtering on that.
 
10:50 PM
@GreenSaguaro You might just want do "without". If so, you can tack ~⊂⍬ on to the end, needing parens, or prepend with ⍬⍬~⍨
I assume you are removing an empty numeric vec -- you might need to modify if removing not exactly that.
 
11:08 PM
@PaulMansour Yes, that is exactly what I was trying to remove. Thank you!
 
11:21 PM
@PaulMansour Why does ⍬⍬~⍨ require two empty arrays? I can see in the REPL that this is needed, but I do not understand why.
 

« first day (1896 days earlier)      last day (775 days later) »