@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.
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
@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": ~
@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 {⍺⍺ ⍵}
@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…
@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:
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".
@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…
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
@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
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