10:46 AM
@Adám Oh cool. Rodrigo also gave a talk on the paper at last year's User Meeting, right? dyalog.tv/Dyalog22/?v=LQz1b14YYiI
yes, indeed.

4 hours later…
3:00 PM
Welcome to APL Quest 2020-1! Today's quest is Let’s Split!:
> Write a function that, given a right argument `Y` which is a scalar or a non-empty vector and a left argument `X` which is a single non-zero integer so that its absolute value is less or equal to `≢Y`, splits `Y` into a vector of two vectors according to `X`, as follows:
> ⠀• If `X>0`, the first vector contains the first `X` elements of `Y` and the second vector contains the remaining elements.
> ⠀• If `X<0`, the second vector contains the last `|X` elements of `Y` and the first vector contains the remaining elements.
`{⌽⍣(⍺<0)⊢(⊂⍺↑⍵),⊂⍺↓⍵}`
That's very clean. I'd personally strand `(⍺↑⍵)(⍺↓⍵)` but being explicit works.
You could also make a fork: `{⌽⍣(⍺<0)⊢⍺(↑,⍥⊂↓)⍵}`
Thanks, was looking for that. Still find it difficult to construct.
With this formulation, can you think of how we could get rid of the `⊢` (not adding parens — just by moving things around?
Another solution I was working on was with ⍨
between the ↑ and ↓
3:05 PM
How?
if the left argument is <0 the only thing you have to do is swap the part before and after the ravel
Right, but you can't do a conditional `⍨` as that would require a hyperator.
Who can find a solution that doesn't involve reversing?
exaxctly I was looking for. A operator that takes operators
Dyalog doesn't have those, though they do exist in NARS2000.
```:63767590 by making it tacit? I got stuck at
(⌽⍣2(⊂↑),(⊂↓))```
where the 2 must be exchanged with the condition
`⍺<0`
or ⊂⍤↓
and ⊂⍤↑
and no parens
3:10 PM
@Richard Right, that's a principle of explicit-to-tacit conversion: The process cannot translate an expression that contains ⍺ or ⍵ free in the operand of an operator.
but something like <∘⊣ should be possible
No, `⍣` doesn't pass the outer arguments to the operand.
If you give it a function operand, it'll do fix-point instead.
@Richard However, since we only have two elements, note that a 1-step rotation is the same as a reversal, so you can use dyadic `⌽` where the left argument is a function of the outer left argument.
ah yes!
I almost have a non-reversing/rotating solution. Only fails if `(|⍺)=≢⍵`
`{(⍺<0)⌽(⊂⍺↑⍵),⊂⍺↓⍵}`
3:18 PM
Right, and that can be made tacit.
like this: (0<⊣)⌽↑,⍥⊂↓ ?
Yes.
huh i'd expect it to be `<∘0⌽↑,○⊂↓`
oh too much bqn. not ○
and not ∘
`((0>⊣)⌽⊂⍤↑,⊂⍤↓)`
no wait ∘ is right nevermind :)
3:21 PM
@BrianBED Since the function is dyadic, it will be `larg(<∘0)rarg` which is invalid.
ohh yea definitely too much bqn
@BrianBED this BQN's atop?
It might be nice to relax `∘` to ignore the argument on the side that's taken.
@Silas No, it is bind here, but BQN uses different symbols for that.
oh, ok - and then errors as attempting to give two rargs?
Yes.
Anyway, we're still missing a non-reversing solution.
And I'm now thinking about a completely different approach too.
3:26 PM
@Adám via a conditional commute?
You can't do that.
:)
yeah...
would be really cool :)
@Silas tried to do that with the power operator, but it doesn't accept operators as operand
3:28 PM
yeah, there's no hyperators - was thinking more apply ,⍨ multiple times but won't work
@Adám i would like that. Didn't we discuss something like this once? actually, is there anything planed for f⍛x?
No, but this is a consistent extension.
I was thinking default-value for `⍛`
right right
@Adám we can probably just calculate the truncated part using ≢. I did that but gives a very long solution
3:32 PM
Try!
I did, have to look back ...
@Richard interesting, I had an alpha >= 0 rotate iirc
I guess the power looks neater
oops, skipped a part of the conversation :)
I'm so close.
How do I do this mapping?
``` 1→1 2 ⋄  2→1 3 ⋄  3→1 4 ⋄  4→1 5
¯1→1 4 ⋄ ¯2→1 3 ⋄ ¯3→1 2 ⋄ ¯4→2 0```
3:41 PM
`    1 (⍵+1)×(⍵>0)+(5+⍵)×(⍵<0)`
Got it: `{⍵⊂⍨⍸⍣¯1⊢1,⍺+1+4×0>⍺}`
oh wow
I have `((⊢|+)(⊣+(0=⊣)×⊢)⊢)∘≢(↑p↓)⊢`
where p is the pair function
`,⍥⊂`
yeah ,⍥⊂ or {⍺⍵} whatever
⍮ also
3:46 PM
⍮-)
@RubenVerg Can probably be cleaned up a bit.
actually, this might work `(1+⊢|(¯1++))∘≢(↑p↓)⊢`
I think I actually fail to distinguish between ⍺=0 and ⍺=≢⍵
`⍺` cannot be 0
oh
works then
@RubenVerg Fails on `⍺=-≢⍵`
yeah
3:50 PM
So close!
that's the same problem that I thought I had with 0
I think I could figure something out - but I'll work on it tomorrow, gotta go now
I have a feeling that the problem here is that `|` doesn't respect `⎕IO`
Have to go, thanks for today!
Yes, we should finish. Next week is 2020-2: Character Building, but maybe we'll find a good non-reversing `↑,⍥⊂↓` solution before then.
Got it: `{⍵(↑,⍥⊂↓)⍨⍺+(≢⍵)×0>⍺}`
Crazy golf: `⊢(↑,⍥⊂↓)⍨<∘≡⊥,⍨∘≢`
4:10 PM
I would argue that commute is nothing but the reverse of operators :)
It is, but we want conditional commute.
ik, just joking
I may just be bad at searching but aplcart might benefit from a {take, drop} while element satisfies predicate operator
I have a simple implementation that is probably not good enough - it would work if dyalog was a lazy language, (1=2÷)op 2 2 2 1 0 shouldn't fail - and a way too overcomplicated correct solution, I'm sure there is an elegant correct sol which I can't write
4:30 PM
@Adám is the problems tester working? It seems to be stuck after pressing test
@Silas Its backend is down. (Shares backend with a couple of other things.)
@RubenVerg The APL way is `∧\pred` used as left arg for replicate
Ah, thought so. Thanks for confirming
@Adám that was the "not good enough" implementation :)
though it should be good enough for the problem
why isn't it good enough?
see the example
a later item erroring shouldn't error the function if it is after the cutoff element
4:49 PM
Then there's no APLy way to do it.
yeah guess so