« first day (2611 days earlier)      last day (340 days later) » 

10:32
Any suggestions to optimise this code?
(∨/∘∊(2,/⌽)∘.≡2,/⊢)
https://leetcode.com/problems/existence-of-a-substring-in-a-string-and-its-reverse/description/
10:49
does ∨/(2,/⌽)∊2,/⊢ work?
I feel like there must be a way to do it without doing the pairwise reduction twice but couldn't come up with anything better
I had exactly the same feeling about doing the reduction twice.
But removing the outer product is nice! I do not know if internally ∊ is also some kind of outer product. But your suggestion is much cleaner and straight forward.
11:16
 cmpx '(∨/∘∊(2,/⌽)∘.≡2,/⊢)t'  '(∨/(2,/⌽)∊2,/⊢)t'
  (∨/∘∊(2,/⌽)∘.≡2,/⊢)t → 5.7E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (∨/(2,/⌽)∊2,/⊢)t     → 2.0E¯4 | -97% ⎕
:)
 
3 hours later…
14:03
Hi everyone! I'm trying generate some reports using SharpLeaf (I'm on Windows). Is it possible to use Unicode in SharpLeaf? Unfortunately I get unreadable PDFs when using cyrillic letters. SharpPlot, on the other side, works great with cyrillic script. Changing font does not help. Explicit conversion using

⎕USING←'System.Text'
Encoding.Default.GetString ⊂System.Text.Encoding.UTF8.GetBytes ⊂'Пример'

also does not work.
 
1 hour later…
15:27
@Richard try this
      cmpx '{∨/⊃,/(2,/⌽⍵)⍷¨⊂⍵}t'  '(∨/(2,/⌽)∊2,/⊢)t'
  {∨/⊃,/(2,/⌽⍵)⍷¨⊂⍵}t → 7.6E¯6 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (∨/(2,/⌽)∊2,/⊢)t    → 1.1E¯5 | +42% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
is more optimizing than comparing pairs, because it can use fast string search algorithm
 
2 hours later…
17:26
@LdBeth this seems to run much slower for me. what test data t did you use?
      t←⎕a[?1000⍴≢⎕a]
      cmpx '{∨/⊃,/(2,/⌽⍵)⍷¨⊂⍵}t'  '(∨/(2,/⌽)∊2,/⊢)t'
  {∨/⊃,/(2,/⌽⍵)⍷¨⊂⍵}t → 2.1E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (∨/(2,/⌽)∊2,/⊢)t    → 1.2E¯4 | -95% ⎕⎕
 
1 hour later…
18:38
t←⎕A[?1000⍴26]
in my case
 
2 hours later…
20:40
      cmpx '(∨/∘∊(2,/⌽)∘.≡2,/⊢)t' '(∨/(2,/⌽)∊2,/⊢)t' '(∨/⌽(≢⍤⊢>⍳⍨)⍥{(¯1↓⍵)(,⍤0)1↓⍵}⊢)t'
  (∨/∘∊(2,/⌽)∘.≡2,/⊢)t             → 1.9E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (∨/(2,/⌽)∊2,/⊢)t                 → 8.4E¯5 | -57% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (∨/⌽(≢⍤⊢>⍳⍨)⍥{(¯1↓⍵)(,⍤0)1↓⍵}⊢)t → 5.0E¯6 | -98% ⎕
Timings taken on 18.0 which might also have some special handling that computes ∘.≡ using .
The flat version at the end is so long partly because there's no high-rank , so it has to get it with instead. In BQN it's just (∨´⌽∊○(2⊸↕)⊢)t. And it's 5x faster too (9.2e¯7s).
21:01
∨/,(⊢∧⍉){1@(2,/⍵)⊢0⍴⍨,⍨1+⌈/⍵}(∪⍳⊢)t is an interesting approach: mark each pair in a 2D grid, then compare against its transpose. Fast flat version is fairly long though:
∨/,(⊢∧⍉){⎕IO←0⋄l←1+⌈/i←(∪⍳⊢)t⋄l l⍴1@((lׯ1↓i)+1↓i)⊢0⍴⍨×⍨l}t
 
2 hours later…
23:14
@RubenVerg string size less than 10
Well, seems (1∊⍷) has no special optimization
23:40
J have +./@:E. as special primitve

« first day (2611 days earlier)      last day (340 days later) »