12:05 AM
Hmm. Haven't learned those operators yet.
Any other ideas?
You could get indices of ones using `x/y` (replicate)

5 hours later…
5:40 AM
@mo523 Indeed, getting the locations of the spaces and finding the pairwise differences would probably be the most efficient approach.

3 hours later…
8:49 AM
@Bubbler Iirc this is more or less the intended approach. Like mo523 said, at that point in the book the set of primitives that are available is rather limited.
9:24 AM
@Adám I finally found the 3, but only because it's in APLCart. The fact that this works as it does seem to be axiomatic ("it just does, right") rather than derivable, or is there some deep insight here?
@xpqz It is 100% derivable. `x⊤y` represents `y` in mixed radix `x`. The result rank is the sum of the ranks of the arguments. For vector arguments, the result has one column per element of `y` and one row per element of `x`. So if neither has any elements, the result is a 0-by-0 matrix.
You can get the original `⍬` back again by evaluating the result in mixed radix `⍬`, or in other words: `⍬≡⍬⊥⍬⊤⍬`
9:39 AM
I might pinch that for my thing.
@xpqz What thing?
@xpqz Relatedly, do you know that and why `1⊥` is equivalent to `+⌿` and `⊥⍨booleanVector` is equivalent to `+/∧\⌽booleanVector`?
Cool.
However, while `1⊥` and `⊥⍨` have come to be accepted for efficiency, `⍬⊤⍬` is still frowned upon in production code.
@Adám I think `1⊥` makes intuitive sense. I'd not seen `⊥⍨` before.
Is `⍬⊤⍬` frowned upon because it's non-obvious until you know it?
@xpqz Yes. It doesn't provide anything but obscurity and golfiness over `0 0⍴0`, as opposed to `1⊥` and `⊥⍨` which can decrease run time.
9:48 AM
Cute tho. Not that I've found myself needing `0 0⍴0` for anything in my APL journey so far.
10:05 AM
Announcement: The recording of the Iverson Centenary is now available:

2 hours later…
11:41 AM
@xpqz my thought process was "I need something that can increase the rank of `⍬` → look through language bar → ooh `⊤` does that → try random arguments"
For a 4, there's also `0/⍪⍬`
11:58 AM
@dzaima yeah I was looking at ⍪ but forgot about ⊤
@rak1507 I did look at `⍪` for a long while, but that was before the lb scanning
Any more 4s?
@xpqz Write a brute forcer and find out!
Funny, I actually started down that path before I thought "I wonder if this is on APLCart..."
Writing a bruter will give me something to do during this afternoon's meetings.
12:36 PM
CMC: R8⍨←⎕⍣⎕÷0F2⋄1=D+÷/⌊⋄C⍬⌈←7T∘
Arrange the order to obtain the golden ration.
@brgal Split into two messages to enable markdown.
@Adám Thanks. I did not know.
@brgal You mean: create a permutation of these symbols so that the expression computes the golden ratio?
:58553838 Yes
The golden ratio is a constant. Why the inputs (`⎕`)?
12:53 PM
@Adám ⎕ not used as input here
Oh, of course. A permutation. My bad.
@brgal `⋄⎕FR←1287⋄+∘÷⍣=⍨⌈⌊÷/⍬⌊⌈⎕DCT←0`
```@Adám
NOT PERMITTED: Illegal token
⎕FR←1287 ⋄ +∘÷⍣=⍨⌈⌊÷/⍬⌊⌈⎕DCT←0
^```
Oh :-(
@Adám there are lots of 3s, btw
`+⌸⍬` `⊤⍨⍬` `↑⍸0`
@brgal `⋄⋄+∘÷⍣=⍨⌈⌊÷/⍬⌈⎕DCT←0⌊⎕FR←1287` is fun. We don't actually need the `⋄`s!
1:01 PM
```@Adám
NOT PERMITTED: Illegal token
+∘÷⍣=⍨⌈⌊÷/⍬⌈⎕DCT←0⌊⎕FR←1287
^```
``⎕FR←1287⋄⎕DCT←0⋄+∘÷⍣=⍨⌈÷⌊/⍬``
Is the bot working ?
It is, but it probably doesn't like `⎕FR`.
`⋄+∘÷⍣=⍨÷/⍬`
@Adám `1.618033989`
Cool ! I learned something ! The original was this one as you guessed it :
⎕FR←1287⋄⎕DCT←0⋄+∘÷⍣=⍨⌈÷⌊/⍬
`⋄⍟⌸⍬`
1:04 PM
@xpqz Response looks like a 0-by-0 matrix.
@xpqz Wow, these are nice!
I count 35 3s.
@xpqz Deserves a blog post?
Most of them a variant on the Key one.
Of course, any scalar function will do as operand.
1:07 PM
Checking 4s now, but that's a larger search space...
This one's nice: `↑⍸0` -- that should have occurred to me.
Meh, loads of them will be trivial no-ops added to the 3s.
CMC: Produce `0⍴⊂⍬` without using any primitive functions (operators are OK).
The 4s are all boring.
1:44 PM
@Adám perhaps. I certainly learnt one or two new things.
@xpqz Then others probably can too.
@xpqz Can you dump them here?
2:01 PM
@Adám notes and brute-forcer here: gist.github.com/xpqz/90b99e3906a2deaa002ef4cf811e9ae1
The 3s: `⍬⊤⍬ +⌸⍬ -⌸⍬ ×⌸⍬ ÷⌸⍬ *⌸⍬ ⍟⌸⍬ ○⌸⍬ |⌸⍬ ⌈⌸⍬ ⌊⌸⍬ ⊤⍨⍬ ⊤⌸⍬ ⊢⌸⍬ =⌸⍬ ≠⌸⍬ ≤⌸⍬ <⌸⍬ >⌸⍬ ≥⌸⍬ ∨⌸⍬ ∧⌸⍬ ⍲⌸⍬ ⍱⌸⍬ ↑⍸0 ↑⌸⍬ ↓⌸⍬ ⍷⌸⍬ ∩⌸⍬ /⌸⍬ ⌿⌸⍬ ⍴⌸⍬ ⌽⌸⍬ ⊖⌸⍬ ⍉⌸⍬`
@xpqz Why `:trap 2+⍳10` and not `:trap 0`?
I wasn't sure how to use :trap at first -- that's a left-over...
@xpqz I disagree that all the Key ones are the same.
Only all the scalar operands are the same.
@xpqz `⊤⌸⍬` `⊢⌸⍬` `↑⌸⍬` (same as `↓⌸⍬`) `⍷⌸⍬` `∩⌸⍬` `/⌸⍬` (same as `⌿⌸⍬`) `⍴⌸⍬` `⌽⌸⍬` (same as `⊖⌸⍬`) are all interesting. I don't see how `⍉⌸⍬` works.
So, a blog post explaining each of these dozen approaches… Sounds like interesting reading to me.
2:29 PM
@Adám `((0⍨¨'')⍨¨'') ≡(0⍴⊂⍬)`
``((0⍨¨'')⍨¨'') ≡(0⍴⊂⍬)``
@Adám To run APL code, write code blocks starting with `⎕←` or `⋄` or write a multi-line code block and prepend `⎕←` or `⋄` to lines you wish to run. All matching groups / lines will be joined by `⋄` and run via TryAPL, and the output will be posted here. To format a codeblock, write ``code``, or for a multi-line code block, use Shift+Enter to type multiple lines and press Ctrl-K, press the 'fixed font' button, or prepend four spaces to each line.
@brgal You solved the task. However, it can be done much shorter and simpler: `⍬⍨¨⍬`
@Adám I was wrongly thinking I could not used ⍬. In the Dyalog language help table, ⍬ is listed as a primitive function - even if it is not as it is a vector.
@brgal Oh, I see. Clever.
2:38 PM
@Adám Thanks for the amusing CMC. Now I can go to sleep !
@brgal Sleep well. When you want more of that type, a recent CMC was to implement monadic `×` for all integers in the range ¯32768 – 32767 without using any primitives or system functions at all. You can only use syntax and literal constants.
operators are fine?
2:56 PM
seems somthing like `{({1}⍣⍵)0}` would work
3:07 PM
`{0::¯1 ⋄ ({1}⍣⍵)0}`
using error guard

1 hour later…
4:24 PM
@LdBeth No. No primitives. Operators are primitives.
4:39 PM
@Adám for `]rows on` is there a way to set a max width that's more than the width of the screen, but less than what it takes to make RIDE cry?
4:51 PM
@dzaima You want it to chop at that width?
@Adám yeah, like it currently does at 32767
@dzaima Doesn't look like there's an option for that. But I agree that could be useful. I'll try to keep that in mind for when we rewamp the output control.
@dzaima But RIDE should handle it. Can you log an issue against RIDE where you show how things go awry?
with scripting there won't be any limit on width right?
Correct.
phew
4:54 PM
@Adám it's using HTML, it's of course gonna not be happy with 32767×40 characters (by "not happy" I mean slow)
@dzaima Oh.
and since you don't give the option of clearing the session history, for the next 20 or so evaluated REPL lines I just have to deal with slowness ¯\_(ツ)_/¯
@dzaima Can you log an issue against RIDE for a way to clear the log?
@Adám isn't it the interpreter that handles the log?
(and clearing the log is the bad solution to this problem. I like the log, just not the 32767-character-long lines in it.)
@dzaima Yes, but I think RIDE only asks the interpreter for the log at connecting time, and RIDE doesn't have a built-in way to ask the interpreter to clear the log. You can try `{1⎕NQ(⎕NEW'Timer'(⊂'Event'('Select'⍵)))'Select'}'[newlog]'` but I don't have high hopes.
Maybe log an issue that RIDE with long lines in the log is slow.
5:02 PM
@Adám it domain errors (and disobeys `]rows on`!!!)
Disobeys because error text doesn't go through the output handler.
@Adám it seems to use monaco, not a custom thing (it's also in html/js so uhh slow is usual), so there's nothing that could be done about it
:-(
(btw this is pure stupid)
I'll look into setting a custom cut-off.
@dzaima Can you look at `]rows -??` and have a think about how a max-width setting could be fitted into the current syntax?
5:06 PM
@Adám i assume `]rows on -max=1000` or something
(for `-style=long`)
(or `-width=1000`, idk)
also, for whatever reason, `]rows on -fold=2` makes `⍪⍳40` pad each printed line to that 32767..

2 hours later…
6:53 PM
@Adám the "iterate" example on APLcart is broken and I fixed it
```      bpow←{⍺←⊢ ⋄ r⊣⍺ ⍺⍺{r,∘⊂←⍺ ⍺⍺ ⍵}⍣⍵⍵⊃r←⊂⍵}
+/ bpow 2⊢vec
VALUE ERROR
bpow[0] bpow←{⍺←⊢ ⋄ r⊣⍺ ⍺⍺{r,∘⊂←⍺ ⍺⍺ ⍵}⍣⍵⍵⊃r←⊂⍵}
∧```
```      bpow←{⍺←⊢⋄r⊣⍺ ⍺⍺{⍺←⊢⋄r,∘⊂←⍺ ⍺⍺ ⍵}⍣⍵⍵⊃r←⊂⍵}
+/bpow 2⊢vec
┌─────┬───────┬──┐
│1 2 3│6 15 24│45│
│4 5 6│       │  │
│7 8 9│       │  │
└─────┴───────┴──┘```
btw, is this expected behavior? why?
```      it←{⍺⍺∘⍵⍵}
it
SYNTAX ERROR
it
∧```
huh, interesting
worse, `¨` alone in the REPL works, but `∘` errors
@KamilaSzewczyk one message up
oh. I didn't scroll, just clicked on the picture, sorry
7:58 PM
@KamilaSzewczyk Thanks. I've committed your fix.
8:18 PM
is there a way to do links for multiline stuff in tryapl?
@rak1507 not yet. planning to implement that next week.
ok cool

1 hour later…
9:21 PM
@dzaima f←¨ ⋄ {⎕←⍵} f ⍳5 works lol wtf
so ¨ and ⍨ work but the rest don't? strange
9:52 PM
A J puzzle I can't figure out. In my deleted answer here there's a unique problem due to randomness with `v^:condition^:_`, which is supposed to generate dice rolls while the condition is true. If two consecutive rolls happen to be identical, the iteration will stop, even if the condition is still true. This is because J thinks we've reached a fixed point `^:_`, because it doesn't realize the main verb is random.
I want some way to say "just keep going until the condition fails, no matter what," but I don't know of another construct besides `^:_` to do this. Recursion with `\$:` is not good because the stack overflows... I guess there is no tail call optimization.
10:49 PM
Yeah, the "while" idiom in J is hacky and not universal
A non-golfing solution would be to use `while.` in an explicit def... but for golfing, I guess a quick solution would be to have a counter along with the current data (so that every iteration is guaranteed to be unique)
11:51 PM
I needed to lookup the solution in the end, but this was the intended approach.
Get the 1 indices, ⍴wds+1
minus 0,indices
result -1
Thanks for the help