7:07 AM
@dzaima Maybe I do have an interesting alternative to `(A f)` meaning `A∘f` and that's that `A(f 1 h)B` means `A f B` and `A(f 0 h)B` means `A h B` and with the corresponding monadic case. This would provide APL with a proper ternary operator. Thoughts?
`(f COND g)Y` would be similarly structured to Python's `f(Y) if COND else g(Y)`

7:27 AM
@Adám hmm, interesting idea, but doesn't really feel like it fits in the general train structure
with a proper ternary conditional though, would it only work on scalar conditions or could it vectorize (making it like 2 `@`s, except not calling empty modifications)?

@Adám I think I like J's ` better

8:28 AM
@dzaima Two `@`s? How and what would it look like?

@Adám something like this, just not executing `⍶`/`⍹` at all if its corresponding argument is `⍬`

@Ven They always seems like a hack to me. You can actually already model that in APL. Better to have a syntax for arrayifying a function into a real scalar of its own type, and have a function which applies an arrayfied function.

@dzaima that's obviously only the monadic version, but it applies pretty much the same dyadically (though not as simply implementable)

@dzaima Missing not?

8:35 AM
@dzaima What, how would it word dyadically? `⍺` is used as selector. You'd have to compose the left argument to the operands (which makes usage in trains very awkward).

@Adám i meant works the same if you could somehow pass all 5 arguments

9:03 AM
@Ven @dzaima Wouldn't it be neater to have ``f` mean the arrayified `f` and extend `⍎` to allow an arrayified function as left argument (and in that case allow any right argument) so you can say `(2⊃`f`g`h)⍎Y` to do `g Y`
If fact, we don't even need to add a new type, as ``f` could simply be `⊂⎕OR'f'` but we do need the syntax so you can use anonymous functions like ``+` and ``{⍺+⍵}`
This would neatly work in trains too, so you can `X(⊢⍎⍨`f`g`h⊃⍨⊣)Y` uses `X` to pick which function to apply to `Y`

i wonder how strange would it be allowing using arrayified functions in a k-style manner

9:23 AM
@dzaima They'd just be scalars, so you can pass then in and out like any other value. You just need `⍎` (which wouldn't be costly like it is for string args) to apply it. I think I can even write a model.
If could also be decided what `⍎` would do with a non-scalar array of functions. E.g. should ``f`g`h⍎1 2 3` be `(f 1) (g 2) (g 3)` or `(f 1 2 3) (g 1 2 3) (h 1 2 3)` ?

@Adám yeah, that works too, just the idea of doing `2 3⊃`+` seems interesting

@dzaima `2 3⊃`+` would rank error ;-)

trying to implement this, but ``f`g` making an array is so annoying to think about

@dzaima How is it any different from `'f' 'g'` ?

@Adám `'g'` has a concrete end and can be parsed tokenize-time, whereas the end of the wrapping of ``` depends on how long the next thing is
what'd ``f∘g` be? `(`f)∘g` or ``(f∘g)`?

9:40 AM
@dzaima It must be short right scope `(`f)∘g`. Use parens ``(f∘g)` if you want to arrayify derived fns.

so it must be tokenize-time (unless i'd make many tiny annoying modifications to my exec engine), as otherwise it'd RTL look at `f∘g`, bind that, and only then see ``` (same with ``f`g` - it sees `f (`g)` and thinks that there's no way that the stranding continues)

Right. This is special syntax.

problem is, i have no idea how to get my tokenizer to bind the ``` to its next token without introducing a whole another pass-trough of everything or having constant checking for whether there's a backtick the current token should be added to

10:08 AM
oh forgot my tokenizer wasn't recursive ಠ_____ಠ
i mean it kind of works

@dzaima Looks good. Does `⎕←1+(0⊃`{-⍵}`{÷⍵})⍎2` work?

10:24 AM
@Adám yeah, it gives `¯1`
also, reminds me to make output use high minus

@dzaima Oh, I thought that was intentional. But I agree, not being able to use output as input is annoying.

by some reason my oneliner number formatting function is hardcoded to always output `0.912385` for non-integers ಠ____ಠ
oh ಠ_____ಠ
luckily because doubles i don't have to deal with this

11:30 AM
@dzaima When can we hire you already‽

4 hours later…
3:20 PM
⋄ A←7 6 8 2 0 9
⋄ B←10 25 3 1 17
⋄ ⎕←(A,B)[⍋(⍳≢A),(⍳≢B)]

```@J.Sallé
7 10 6 25 8 3 2 1 0 17 9```

⋄ A←7 6 8 2 0 9
⋄ B←10 25 3 1 17
⋄ ⎕←(⍳≢A),(⍳≢B)

```@Skidsdev
1 2 3 4 5 6 1 2 3 4 5```

⋄ A←7 6 8 2 0 9
⋄ B←10 25 3 1 17
⋄ ⎕←⍋(⍳≢A),(⍳≢B)

```@Skidsdev
1 7 2 8 3 9 4 10 5 11 6```

3:29 PM
Ah, my JS implementation of `⍋` doesn't work if the array contains duplicates

@Skidsdev Right. The finer details of `⍋` are actually quite involved.
That's the idea of APL. Pack as much hard work as possible into those funny squiggles, so the APL programmer has all of that at his fingertips (literally).

Okay, I got the shuffle working in JS. I'm sure my GradeUp implementation will fail for some edge cases, but it works for the most part.
have to admit though, my code is a lot longer than `⎕←(A,B)[⍋(⍳≢A),(⍳≢B)]`
I imagine my approach is less efficient too, as it creates 2 copies of the input array
I have to admit, I still don't really grasp the usefulness of `⍋`, but it definitely feels elegant

3:54 PM
@Skidsdev main thing with `⍋` is that it separates the ordering data from the data to be ordered, making it very easy to sort multiple lists by ones order

or sort a table by one or more columns, or even by a column that doesn't exist.

⋄ A←1 2 2
⋄ ⎕←⍋A

```@Skidsdev
1 2 3```

4:16 PM
CMC: `(A,B)[⍋(⍳≢A),(⍳≢B)]`

2 hours later…
6:38 PM
@Adám can we assume A B are of a particular type?

@ngn Of course not.

ok, so 16 bytes for a start :) `(A,B)[⍋∊⍳¨≢¨A B]`

@ngn Accoring to PPCG defaults, it must be a function or program. (Adds 3 bytes.)

@Adám if ⎕ can read both A and B: `⊃,/,⍉↑⎕,¨⍨⊂⊂⍬`
(13 bytes)

6:49 PM
ugh, mine fails for nested arrays :(

@dzaima That's what I had. Good job.

since my `ϼ` is now redundant, how about repurposing it for `⍳≢`?
or `⍳⍴` - forgot that that's an issue :|

@Adám what's the best you have in dyalog apl?

@ngn 17, I think.

I'd love to see some characters that aren't used in the Unicode range becoming shorthand for some commonly used idioms (such as `ϼ ←→ ⍳≢`)
I'm not sure how feasible that would be though, and it'd be mainly for golfing anyway

7:05 PM
@J.Sallé Like `⍪` `⌿` `⍀` for `,[1]` `/[1]` `\[1]`

Yes, exactly
But I meant something more golfy, of course. There's some idioms we seem to use with some frequency, like that `↓⍉↑` trick you told me about the other day

Basically what Jelly does.

take and drop should have been `⤉⤈`

@ngn why?

@ngn The extension to major cells was late, and so there was no extended-to-trailing axis counterpart.

7:10 PM
@dzaima because they work on first axis

ah. my `↓` & `↑` currently require `(⍴⍺)≡⍴⍴⍵`

@Adám well yeah, but more APL flavoured if you'll forgive the pun.

@Adám let's not have another backwards compatibility discussion :)

JayFoad suggested extending them so `⍺` can be of any length, even `(≢⍺)>≢⍴⍵`

7:17 PM
@ngn You'll be embarrassed, it is very straightforward. Are you sure?

`{(⊂⍋∊⍳∘≢¨⍺⍵)⌷⍺⍪⍵}`

@Adám that's just as short as `{(⍺,⍵)[⍋∊⍳¨≢¨⍺⍵]}`

@ngn Yes, but mine works on all ranks.

i see

7:21 PM
@Adám that makes it differ from the original CMC though :p

@dzaima True, the CMC spec could only ever work for rank≤1. It is just a style question.
@ngn Hold on, why did I say adds 3 bytes ‽ It should have been adds 1.
Why didn't you protest? Or say yours was 17 too?
OK, I'm clearly getting tired here. And the sun is setting soon anyway. All the best to y'all!