« first day (784 days earlier)      last day (1853 days later) » 

1:51 PM
codegolf.stackexchange.com/a/181879/60042 <-- why is this so long o_O
 
@Pavel Because nobody has written a shorter one. Try to!
 
Hmm, reverse and join should be one character each, right? (Don't know which ones, tho)
So the only tricky part is doing the chunking
@Adám Is there a chart of APL characters I can look up, I forgot like all of them
 
@Pavel Just a table of symbols or a brief list with descriptions (like Jelly's Atom list)?
 
@Adám The brief description one
 
@Pavel Whenever you forget, just say ")ref":
)ref
 
\o/
 
@Pavel And if you forget what that command is, follow the room description and enter…
)about
 
@Adám You can evaluate a single line of APL by typing it into chat prefixed by ⍞←. Use ⎕← instead for boxed display and multi-line results and use ⋄ instead to silence the first statement. Use ] to call user commands, including ]help ⍣ for help on a glyph etc. Do not use markdown, but fixed-width (4 initial spaces) is fine. Commands: )lb for language bar, )docs for full documentation, )ref for PDF reference card, )idioms for idiom list.
 
Ven
can @ be utilised to operate on chunks? maybe stencil
 
@Ven No, you'd have to partition first. Stencil can, but beware of edges.
 
2:27 PM
I've got a challenge for you all that made my head hurt when I did it in Python, and is certainly going to be abysmal to work out in APL: codegolf.stackexchange.com/questions/95100/…
The old "Build an aesthetically pleasing divisor tree" challenge
I'm not sure I have the stomach for trying to make text formatting work in APL, but I thought making the subtrees, would be interesting
 
2:51 PM
How do you do the thing where you don't need to put the f← into the code field on TIO
(It has 3 commas and I feel like it shouldn't, but...)
 
Ven
@Pavel this?
 
Yes
Thanks
...fuck
Oh I'm a dumbass and managed to typo 2 instead of ⍺... somehow
 
@Pavel I was just about to ask
 
Well, codegolf.stackexchange.com/a/181900/60042 is as good as I can get it, I think.
I'm not gonna begin trying to understand what dzaima's doing
 
@Pavel How about a different method: Cut into chunks of size , reverse the chunks, recombine?
 
3:05 PM
@Adám That's exactly what I'm trying to do with ∊⊖(⌊⍺÷⍨≢⍵)⍺⍴⍵ but the problem is what to do with the leftovers
Since ⍴ wraps
 
@Pavel Well, you're reshaping. Remember that you can have ragged vectors of vectors, not just orthogonal matrices.
 
I don't know any other way to do it
 
@Pavel Look into dyadic
 
Ven
⎕←,/↑(⊂'ab')(⊂'cd ef gh')
 
@Ven
┌──────────┐
│abcd ef gh│
└──────────┘
 
3:08 PM
@Pavel Here's an idea for that approach: Pad with additional elements that you know won't occur in , then remove those at the end.
 
Ven
I always mix up ↑ because of ML differences
.oO( you better not mix your mix )
 
@Ven Why do you use ⎕ML≠1?
 
Ven
I learned mix in GNU APL (which uses ML 3)
 
@Adám The problem with that is I don't know APL and don't know how to pad right or filter
 
@Ven Oh. Remember ups the rank, has ⎕IO as default left argument. Some people think should be "first" as if it had 1 as default left argument, but that's wrong, because dyadic can never return a scalar (except if the right argument is scalar).
@Pavel padding is just concatenation: , Filtering is just "without": ~
 
3:18 PM
n ⍴0 seems to work to get me n 0s, IDK if there's a better way
 
Ven
it's easily optimizable (what am I thinking...)
 
Ven
guess I could save a byte from that 1,1↑ and by using ⍨⊂
@Pavel what's wrong?
I don't see that test case so I'm not sure how it's wrong
 
@Ven Would it make you happy if I add the test case to the challenge? Your solution needs to work for the given rules, not just the few examples.
 
Ven
@Pavel Please don't do that :). But with the foobarbaz case I see something gets shifted to the end
 
3:28 PM
I'm actually pretty surprised how hard this challenge is for APL
 
@Ven Looks like it is
 
@Pavel The thing is, if you give too much data, it just doesn't use the excess, so ⍺⍴0 is fine.
 
o_0
magic
 
Ven
3:36 PM
16 with ∊, even.
 
@Ven Remember how differs from when there isn't enough data?
 
Ven
@Adám pads with the 0 instead of repeating the sequence?
 
@Ven Yes, for simple numeric vectors, that is. You can use this to generate 1 followed by a bunch of 0s
 
Ven
15 then :).
 
Wish I could get the parens out but I think they're stuck in there
 
3:41 PM
@Pavel Yes, there is no other way when stranding
 
stranding?
 
Ven
@Adám I thought ⍺↑1 and (⊣↑1) would be equivalent -- what's the correct incantation?
 
@Ven Trains can't have constants on the right, so you need 1↑⍨⊣
 
I still like my Perl answer better, getting a single regex to do the chunking feels good
 
Ven
∊∘⌽((≢⊢)⍴1↑⍨⊣)⊂⊢ is not shorter, only uglier :(
 
3:47 PM
@Ven ⊂⍨
 
Ven
That makes it the same length as the non-tacit one
 
@Pavel Like this?
⍞←2{∊⌽(1⌽'}.{1,',⍕⍺)⎕S'&'⊢⍵}'abcdefghi'
 
@Adám ighefcdab
 
@Pavel ^^ same length as Perl :-)
 
Woah
Uh, what's that '&' doing there?
 
Ven
3:49 PM
Oh, I ended up with the same solution as dzaima
 
@Pavel Means "entire match".
 
⍞←2{∊⌽(1⌽'}.{1,',⍕⍺)⎕S ⍵}'abcdefghi'
 
@Pavel SYNTAX ERROR
 
Ven
@Adám is there a way in extended to mean "⍺⍺ or ⍵⍵, but monadic? For (≢⊢)`
 
⍞←2{∊⌽(1⌽'}.{1,',⍕⍺)⎕S ⍵}'abcdefghi'
 
3:50 PM
@Pavel SYNTAX ERROR
 
¯\_(ツ)_/¯
IDK the semantics of ⎕S
 
@Pavel ⎕S is a dyadic operator. It takes one or more patterns as left operand and one or more substitutions as right operand. It also needs an argument: pattern ⎕S subst ⊢ arg
@Ven You mean, apply this function to the right argument? As in {⍺⍺ ⍵}
 
Ven
@Adám that takes less than 4 chars, yes
 
@Ven Yes, 3: ≢⍤⊢
 
⍞←⍕42
 
3:52 PM
@Pavel 42
 
@Ven Btw, regular Dyalog has that too, but only for the right argument: ⊢∘≢
 
⍞←2{∊⌽(1⌽'}.{1,',⍺)⎕S'&'⊢⍵}'abcdefghi'
 
@Pavel DOMAIN ERROR
 
Ven
@Adám Let me reply to @dzaima then :)
 
@Pavel The pattern must be character.
 
3:53 PM
Oh, ⍕ is tostring
 
Ven
And actually, it's a 14 bytes answer in Regular too /cc @Pavel
 
Guys, please don't use Classic.
 
@Adám the byte count tho
 
@Pavel TIO tells you the character count, and I anyway edit my "bytes" to link to meta about APL character sets. Otherwise people eventually end up asking…
 
3:55 PM
@Ven You should post
 
Ven
I'd feel bad about it -- you came here asking for golfing tips and I just wanted to try it out on my own, not steal your thunder :).
 
I came here asking "Why tf is the only APL solution to this challenge 35 entire bytes"
At which point @Adám gave me the equivalent of "Be the change you want to see"
 
Ven
And I broke that by starting my own golfing session :-(
The perl solution you posted is pretty nice
 
Actually, but using a full program, APL beats Perl — using Perl.
 
Ven
I feel like I get APL a bit better now
 
4:12 PM
@Adám Wait, elaborate.
 
@Pavel The "full program" ∊⌽(1⌽'}.{1,',⍞)⎕S'&'⊢⍞ is 22 vs Perl's 25, but ⎕S is just a PCRE (i.e. Perl) primitive.
 
Ven
@Pavel Are you sure?
 
@Ven Yes
 
@Pavel .{1,$_} in Perl is '.{1,',⍞,'}' in APL, but I save a byte with a golfing trick; to put the closing brace at the front and rotate it to the end.
 
I really like this solution
 
4:22 PM
@Pavel Which one?
 
Yours, just now
We probably have different concepts of "neat solution"
 
@Pavel Well, I just translated your Perl solution to the literal equivalent.
@Pavel One thing that ⎕R and ⎕S have that no other language I know of have (except for Retina, which only got it by inspiration from Dyalog), is the ability to have multiple patterns and substitutions. This lets you "exclude" things from patterns by capturing them first and leaving them as-is:
⍞←'aa' 'ab'⎕R'&' '_'⊢'aababbabbaab'
 
@Adám aa_bab_bab_baa_b
 
Oops, try again:
⍞←'aa' 'ab'⎕R'&' '__'⊢'aababbabbaab'
 
@Adám aab__b__baab
 
4:30 PM
Here I want to change all "ab" into "__", but not break up any "aa"s, so I capture the "aa"s and substitute them by themselves (&), and only then look for "ab".
 
@Adám You can do that with lookarounds: tio.run/##K0gtyjH9X1qcqmCqZ2BkYf2/…
@Adám Or... whatever this is: tio.run/##K0gtyjH9X1qcqmCqZ2BkYf2/…
\K means Keep, everything left of it isn't included in substitution. $1 is the first capturing group, if it matches.
 
4:49 PM
@Pavel How do you uppercase "ab" but only while considering "slots" of two characters each?
⍞←'ab' '..'⎕R'AB' '&'⊢'babaabaabbaba'
 
@Adám babaABaabbABa
 
@Adám tio.run/##K0gtyjH9X1qcqmCqZ2BkYf2/… Had to flip the order just because .. also matches ab and that wasn't a problem earlier.
 
@Pavel Cool. One more: Uppercase "a" in "ab", but considering slots of two, and replacing everything else with underscores?
⍞← 'ab' '..'⎕R'Ab' '__'⊢'babaabaabbabab'
 
@Adám ____Ab____AbAb
 
@Pavel With slots of two, uppercase the "a" in "ab" and in "ba":
⍞←'ab' 'ba' '..'⎕R'Ab' 'bA' '&'⊢'babaabaabbabab'
 
4:58 PM
@Adám bAbAAbaabbAbAb
 
Ven
e's just cheating :P
 
@Pavel Hold on, now you're executing code on the matches, no?
 
That is what /e does yes
 
@Pavel Of course, we can do that in APL too by giving ⎕R/⎕S a function as right operand. I was talking about pure regex.
 
5:07 PM
Ok, without /e you can only substitution can only consist of constants and values captured from the pattern
 
@Pavel I am only using constants and values from the pattern.
 
Constants, as in they can't be conditionaly included/excluded
 
@Pavel each pattern is mapped 1:1 with its substitution. All substitutions are either constants or from (identical to) the pattern
 
@Adám print 'babaabaabbabab' =~ s/(?<=(?:..)+b?)a/A/rg works in Perl Blead (unreleased, not on TIO)
 
Ven
5:30 PM
@Adám I seem to want, often enough, a this function but with the left/right argument only. Would you consider adding such a built-in to Extended?
(Or, well, 2 built-ins)
OK, wrong an explanation. Whew.
 
5:45 PM
Nov 16 '18 at 7:12, by Adám
@dzaima {⍺⍺ ⍵} is ignore-left-and apply-monadically? I've thought about that. Yes, I agree that a single-char {⍺⍵} would be very valuable. seems like a nice symbol…
 
Ven
6:07 PM
I see, thanks!
 
6:26 PM
So I'm trying to get the prime factors of a number in order of: Get the highest divisor pair, recurse
720 would get 24 30, then 4 6 5 6, then 2 2 2 3 5 2 3
But I can't get {⍬{1=z←⌈/⍵∨⍳⌊⍵*0.5:⍺,⍵÷z⋄⍺,(∇z),(∇⍵÷z)}⍵} to work on composite numbers
Which is a bit of a bummer
⎕←{⍬{1=z←⌈/⍵∨⍳⌊⍵*0.5:⍺,⍵÷z⋄⍺,(∇z),(∇⍵÷z)}⍵}6
 
@Sherlock9
VALUE ERROR
 
@Sherlock9 you're calling without a left arg though it expects one
 
... it's the simplest things
⎕←{⍬{1≥z←⌈/⍵∨⍳⌊⍵*0.5:⍺,⍵÷z⋄⍺,(⍺∇z),(⍺∇⍵÷z)}⍵}720
 
@Sherlock9
2 2 2 3 5 2 3
 
Thanks!
 
6:37 PM
@Sherlock9 you could use ⍺←⍬⋄ though that doesn't make it any shorter
or ⍬∘{1≥z←⌈/⍵∨⍳⌊⍵*0.5:⍺,⍵÷z⋄⍺,(⍺∇z),(⍺∇⍵÷z)}720 actually
 
6:50 PM
Is the "house" prefix for dfns implemented for Extended on TIO?
 
@voidhawk seems so
@Sherlock9 28 bytes, was fun to golf
 
Ven
Dyalog/extended has no bifurcate f w -> (w,f w)?
 
7:07 PM
@dzaima It's 2 am and that fascinates and confuses me greatly. How?
 
@Ven ,∘f⍨ ?
 
@Sherlock9 it tries to split numbers until a fixed point. once the max reaches 1, the train results in ((1~1),(⍵÷1)), which just returns
 
@Sherlock9 dzaima is a wizard, that's how.
 
And ¨∘∊⍣≡ is a fixed point finder ... how?
I forgot .5 would work. That's a byte
 
@Sherlock9 ⍣≡ is find fixed point. f¨∘∊ is equivalent to {f¨ ∊⍵}
 
7:12 PM
Ahhhh
 
@Sherlock9 yeah 0.5 can be either .5 or ÷2
 
@Sherlock9 simple things strike again
 
feckin magic APL again
How do you guess that ⍣ power combined with ≡ match makes repeat until fixed point?
Oh it's in the language help
 
@Sherlock9 the right operand of gets as arguments the last two results, and checks if they're the same. ⍣≡ is a powerful thing and is worth knowing
 
Well, ⍣= is in the language help, which is the same thing but for scalars
@dzaima Beautiful
How would you check for cycles?
 
7:16 PM
@Sherlock9 no idea ¯\_(ツ)_/¯
 
Like the Collatz conjecture where 1 cycles back to 4, 2, 1
Nuts
 
As I said, wizardry only gets you so far. You probably need a warlock now.
 
if the right operand of my got the history as an argument, that'd be usable, but alas it doesn't and just gets the last 2 iterations
 
@dzaima sounds like a <feature-request> to me.
 
@J.Sallé sadly a function only has 2 arguments, and I'm using both
making a 3rd looping operator could be possible though
hmm how about a set type?
seems relatively pointless, but as I'm not planning on optimizing bigArray,scalar, it could improve speed where it's needed
 
7:31 PM
Well, if you concatenate the results into ⍬ and check if the result is a member of the history array
Not sure how to do that idiomatically, though
 
7:59 PM
tetris in my APL. turned out pretty long and with 15 ¨es, but most of those are either with a constant amount or because the vectorizing of APLP5s things is horrible
 

« first day (784 days earlier)      last day (1853 days later) »