« first day (511 days earlier)      last day (2149 days later) » 

4:14 AM
@EriktheOutgolfer I didn't actually ⍨
 
 
12 hours later…
4:36 PM
⎕←10*÷2
 
@Sherlock9
3.16227766
 
⎕←⌈10*÷2
 
@Sherlock9
4
 
⎕←⍳⌊10*÷2
 
@Sherlock9
1 2 3
 
4:39 PM
⎕←⍒⍳⌊10*÷2
 
@Sherlock9
3 2 1
 
Oh heck I should be testing this on TIO, pardon me
 
5:03 PM
@Sherlock9 No, not a problem. Others reading the transcript can learn from your experiments.
 
Oh nice
I figured out without by accident :D
Actually, could you help me golf the following for the Squarish Root challenge?
g←{⍳⌊⍵*÷2}
f←{⌈/(g ⍵)~⍵|⍨g ⍵}
 
@Sherlock9 Cool. Btw, you can get "inline" responses (when your result has just one line) from the bot by using ⍞← instead of ⎕←:
⍞←'Hello!'
 
@Adám Hello!
 
Ohh
I seem to have hit a golfing wall, but this is 50 bytes
 
@Sherlock9 You can count each character as a single byte.
 
5:06 PM
Wait no
I was using Dyalog Unicode
 
@Sherlock9 Doesn't matter, you can just refer to SBCS.
 
That's what I meant. TIO has Dyalog Classic and Dyalog Unicode
And I picked the wrong one for that bytecount
So 29 bytes
 
@Sherlock9 Does {⍳⌊⍵*÷2}(⌈/⊢~|)⊢ work?
 
g←{⍳⌊⍵*÷2}
f←{⌈/(g ⍵)~⍵|⍨g ⍵}
⍞←f 20
 
@Sherlock9 Ah, the bot doesn't understand multi-line requests.
 
5:11 PM
Nuts
 
⋄ g←{⍳⌊⍵*÷2} ⋄ f←{⌈/(g ⍵)~⍵|⍨g ⍵} ⋄ ⎕←f 20
 
@Adám
4
 
@Sherlock9 The leading means suppress output of the first statement's result. And you have to use ⎕← when using multiple statements.
 
So I'm having trouble parsing the (⌈/⊢~|)⊢
 
⎕←{⍳⌊⍵*÷2}(⌈/⊢~|)⊢
 
5:13 PM
@Adám
┌──────────┼───┐
{⍳⌊⍵*÷2} ┌─┴─┐ ⊢
         / ┌─┼─┐
       ┌─┘ ⊢ ~ |
       ⌈
 
⎕←{⍳⌊⍵*÷2}(⌈/⊢~|)⊢20
 
@Sherlock9
DOMAIN ERROR
 
Ah nuts
 
⋄ f←{⍳⌊⍵*÷2}(⌈/⊢~|)⊢ ⋄ ⎕←f 20
 
@Adám
20
 
5:14 PM
Huh
The heck?
 
@Sherlock9 It is a tacit function. You have to name or parenthesise a tacit function before applying it:
⎕←({⍳⌊⍵*÷2}(⌈/⊢~|)⊢)20
 
@Adám
20
 
@Sherlock9 But don't count the parenthesis or assignment in your byte count.
 
Not sure how to do the header/footer thing
In this case
 
@Sherlock9 Template
 
5:16 PM
@Adám Ooh
 
@Sherlock9 Try it online!
@Sherlock9 Wait, it isn't giving the right result ⍨
 
So it needs to be reduce(g ⍵ without (⍵ modulo (g ⍵)), maximum)
If I'm not mistaken
 
@Sherlock9 Oh, I just had a typo: {⍳⌊⍵*÷2}(⌈/⊣~|)⊢
@Sherlock9 Did you learn about trains?
 
Only in Jelly
And it has been quite a while
 
@Sherlock9 While slightly more complicated than Jelly's, Dyalog APL trains are very complicated. Have time to learn it now?
 
5:21 PM
Considering I still have no idea how the and work, I can make time
Can you explain the answer without delving too deep?
As I'd like to post, shower, then learn
 
@Sherlock9 Sure, but and are the simplest functions ever: returns its left argument. returns its right argument.
 
... ohhhh
Wait so reduce(⍵ without modulo, maximum) right
 
@Sherlock9 I'll try: {⍳⌊⍵*÷2}(⌈/⊢~|)⊢ is a 3-train, f g h where f←{⍳⌊⍵*÷2} and g←⌈/⊢~| and h←⊢.
 
...
Right
 
First f ⍵ and h ⍵ (which is just ) are calculated. Then their results become left and right arguments to g
g is 4-train, F G H I where F←⌈/ and G←⊢ and H←~ and I←|.
First ⍺ G ⍵ and ⍺ I ⍵ are calculated. Their results become left and right argument to H. Then the result of that becomes the argument to F.
 
5:26 PM
⍵ the left or right arg?
I have forgotten
And I've been using ⍵ this whole time too ⍨
 
@Sherlock9 Right(most letter of the Greek alphabet).
 
Consarnit
So ⍺ G ⍵ gets ⍵, and ⍺ I ⍵ gets ⍺ mod ⍵
Since ⍺ is the old g and ⍵ is the input, we get ⍵ without ⍵ mod g ⍵
I think?
 
g is equivalent to the dfn {⌈/(⍺⊢⍵)~(⍺|⍵)} but of course (⍺⊢⍵) is just , so you have {⌈/⍵~⍺|⍵} but remember that here is f ⍵, so really you have your original code.
@Sherlock9 Yes, that's all correct.
 
ohhh
And the outer F G H is the ⍺ inner chain ⍵ which is g ⍵ inner chain ⍵
Since the inner chain is the old f, I get my original code back
 
@Sherlock9 Yup.
 
5:31 PM
Holy shit
 
@Sherlock9 That's how I golfed it (i.e. this explanation in reverse) without having any idea what your code was doing.
 
XD
Should I replace the ⍵ in the F-block?
No, the main single arg is right arg
 
@Sherlock9 Right, monadic functions only use and not .
 
@Adám Heh. Right.
 
So why do we need the H-block at the end ?
 
5:42 PM
@Sherlock9 You mean what I called lowercase h?
 
Whoops. Yes, that
 
because it's not Jelly
:)
 
Oh. I have been spoiled by implicitness
 
Because {⍳⌊⍵*÷2}(⌈/⊢~|) would be {⍳⌊⍵*÷2} applied monadically to the result of (⌈/⊢~|) applied monadically to the argument.
 
Implicated, even
 
5:46 PM
@Adám is there a word missing?
 
@FrownyFrog Heh, yes, a not
 
I'll be back in a minute, and then let's discuss APL chains
@Adám So chains. How do?
 
6:04 PM
@Sherlock9 They are usually called trains.
 
Heck
Let me go edit my answer
 
I'm not convinced your answer is correct @Sherlock9. EDIT it fails for 13, returning 3
 
Oh dear
 
You're doing ⊢~| which removes the remainders from the list you start with. You want to remove the numbers with those remainders
 
Ah, my mistake
 
6:13 PM
@Sherlock9 So trains are sequences of functions without any data on the far right. It can either be because the statement ends, or because there is a right-parenthesis.
 
@Sherlock9 Note that (or on booleans) gives the gcd of its arguments. This is helpful for getting a short solution to that question
 
@H.PWiz Nitpick: it is GCD on Booleans too.
 
Right, I was merely describing it in the context that he learnt it
 
Nuts, I can't get and to work
Okay, so functions without data. Makes sense
 
@Sherlock9 Can I have some context?
 
6:18 PM
I'm trying to get an array to drop values at specific indices
And I'm not sure what the syntax is
 
@Sherlock9 drops a number of elements from the edge.
 
Oh barnacles
 
⍞←3↓3 1 4 1 5 1 9
 
@Adám 1 5 1 9
 
⍞←¯3↓3 1 4 1 5 1 9
 
6:19 PM
@Adám 3 1 4 1
 
What functions take values at specified indices?
 
@Sherlock9 Boolean/data filters data.
 
Riiiiiight
 
@Sherlock9 So if you have a set of indices, you could do (~indices∊⍳≢data)/data
 
@H.PWiz how long is yours?
 
6:22 PM
12
 
the / is a function in this case
⍞←3 1 0/10 20 30
 
@FrownyFrog 10 10 10 20
 
I fixed it and lost two bytes!
{⍳⌊⍵*÷2}(⌈/∨)⊢
I could probably lose more now
 
@Sherlock9 Nice! Just stick it all in one dfn now (and maybe go further from there)
 
@Sherlock9 nice, I didn't think to use ⌈/
 
6:36 PM
@Sherlock9 your link is wrong. I had a similar 12 byte solution
 
I think I got it fixed
@H.PWiz Ooh very nice
@Adám Sorry, I think we got sidetracked
 
@Sherlock9 No problem.
 
also 12
somehow ∨∘⍳∘⌊ does exactly what I meant
 
I was just about to post the same train :)
 
haha
 
6:44 PM
@Adám So a train is a sequence of functions without data on the far right
Can you have a one-function train?
 
@Sherlock9 Well, you can have a single function, we just don't call it a train.
 
Fair enough
So what kinds of trains do you have?
 
@Sherlock9 Yes, sorry, I got distracted.
 
Ah, that's alright. Start when ready.
 
@Sherlock9 Let's look at the monadic case first. If you have the train t←f g then the result of t ⍵ is f g ⍵.
 
6:49 PM
Alright. Simple enough
 
@Sherlock9 If you have t←f g h then t ⍵ is (f ⍵) g (h ⍵)
If you have t←f g h i then t ⍵ is f (g h i) where (g h i) is just another train as above.
 
Well, that's a little tougher to remember
Are f g and h all monads?
 
@Sherlock9 Yes.
 
Ah, this is a fork
 
@Sherlock9 Exactly.
 
6:52 PM
So say I want to do f(g(h(⍵))) instead
Do I have to use ○ composition?
 
@Sherlock9 You could use f∘g∘h
 
Or just f(gh)⍵?
 
@Sherlock9 Yes, f(g h) or (f g)h works as well.
 
Excellent
 
@Sherlock9 Now you get what f g h i j is, right?
 
6:55 PM
f g (h i j)
 
@Sherlock9 Yes.
 
So (f ⍵) g ((h ⍵) i (j ⍵))
 
@Sherlock9 Yes.
And so on.
@Sherlock9 Btw you may substitute any of the (x ⍵)s for an array.
 
except the last one
 
I was wondering about that in the reference card
 
6:58 PM
oh right
 
What does Xgh mean?
 
@Sherlock9 Array Function function
 
Do you have an example of this at work?
 
@Sherlock9 Sure. Mean←+/÷≢
@Sherlock9 Or do you mean using a constant?
 
Using constants would be good
 
7:01 PM
@Sherlock9 Twice←2×⊢
 
I forgot about scalars again
 
@Sherlock9 Scalars? As in scalar functions or arrays that are scalars?
 
The second one
I forgot that they counted as arrays ⍨
 
@Sherlock9 A scalar is just a rank-0 array.
 
Yeah but I was thinking, how would I do vector function function?
 
7:03 PM
@Sherlock9 A vector is just a rank-1 array.
 
⍞←{(1 2 3)×⊢}⋄4
 
@Sherlock9      ∇{(1 2 3)×⊢}
 
Whoops
 
@Sherlock9 {} are for dfns, not trains.
 
⍞←((1 2 3)×⊢)4
 
7:04 PM
@Sherlock9 4 8 12
 
There we go
 
@Sherlock9 And you don't even need parenthesis around the vector.
 
⍞←(1 2 3×⊢)4
 
@Sherlock9 4 8 12
 
Interesting
 
7:05 PM
@Sherlock9 OK, ready for dyadic trains?
 
I hope so
Let's go
 
@Sherlock9 If t←f g then ⍺ t ⍵ is f (⍺ g ⍵)
 
Do I have to write this as ⍺(f g)⍵ with the parentheses?
 
Yes
 
@Sherlock9 Yes. Otherwise it isn't a train, and you get ⍺ f (g ⍵)
 
7:07 PM
Fair enough
 
Or otherwise it's interpreted as ⍺ f (g ⍵)
 
@Zacharý Ninja!
 
ninja'd
 
@Sherlock9 You can of course name it too.
@Sherlock9 If t←f g h then ⍺ t ⍵ is (⍺ f ⍵) g (⍺ h ⍵)
 
@Adám So (t ⍵)⊢t←f g ?
 
7:10 PM
Hence, if in a dyadic train, you just want the value of one of the arguments, you use or because ⍺ ⊣ ⍵ is and ⍺ ⊢ ⍵ is .
@Sherlock9 What?
 
Makes sense
@Adám For naming
I forgot what where is
 
@Sherlock9 You may have meant (t ⍵)⊣t←f g just like 2×a ⊣ a←3 but that won't work.
 
Oh
So how do you name trains mid-program?
 
Because is just a normal function, (t ⍵)⊢t←f g will get you the train (t ⍵)⊢t which is an array-function-function train.
@Sherlock9 You can do it, but you have to use it right then.
 
@Adám Do you have an example?
Even a contrived one
 
7:14 PM
@Sherlock9 E.g. avg(avg⊣),((avg←+/÷≢)⊢) the average of the average of and the average of .
 
@Adám Ah okay
 
@Sherlock9 Otherwise, you can just define the necessary functions in a different statement: avg←+/÷≢ ⋄ avg(avg⊣),(avg⊢)
 
So going back to t←f g h and ⍺ t ⍵ being (⍺ t ⍵) g (⍺ h ⍵)
Riiiight. I forgot about the diamonds
 
@Sherlock9 Yes, well, with t←f g h i then ⍺ t ⍵ is f ⍺(g h i)⍵
 
And with t←f g h i j we get (⍺ f ⍵) g ((⍺ h ⍵) i (⍺ j ⍵))
 
7:18 PM
@Sherlock9 Exactly, you got it. And so on.
@Sherlock9 So really, you can see that the rules for monadic and dyadic application of trains are identical. When monadic, you just remove the s.
@Sherlock9 You can find a summary here.
@Sherlock9 Btw, the chat bot (and TryAPL, and a local APL, and — with some effort — TIO) can show you the structure of a train:
⎕←Mean←+⌿÷1⌈≢
 
@Adám
  ┌─┼───┐
  ⌿ ÷ ┌─┼─┐
┌─┘   1 ⌈ ≢
+
 
⎕←⌊/,⌈/
 
@Sherlock9
  ┌─┼─┐
  / , /
┌─┘ ┌─┘
⌊   ⌈
 
@Sherlock9 Here you can clearly see the Afg fork on the right which in turn becomes the g of an overarching fgh fork.
@Sherlock9 And it even shows that +⌿ and ⌊/ and ⌈/ are composite "derived" functions.
 
⎕←( +,-,×,÷)
 
7:32 PM
@Sherlock9
┌─┼───┐
+ , ┌─┼───┐
    - , ┌─┼─┐
        × , ÷
 
⎕←(⌽+,-,×,÷)
 
@Sherlock9
┌─┴─┐
⌽ ┌─┼───┐
  + , ┌─┼───┐
      - , ┌─┼─┐
          × , ÷
 
@Sherlock9 And there you have something like an list of functions:
⍞←(+,-,×,÷,⌊,⌈,|) ¯2.5
 
@Adám ¯2.5 2.5 ¯1 ¯0.4 ¯3 ¯2 2.5
 
Haha
 
7:35 PM
@Sherlock9 So in APL, you can write 5 ± 2 as:
⍞←5 (+,-) 2
 
@Adám 7 3
 
Ooh
 
The dfns function vectors use namespaces, right?
 
All of these trains remind me of a Jelly answer I wrote for one of my own challenges a year or two ago: codegolf.stackexchange.com/questions/102904/…
I think I should try writing an APL answer. See if it's simpler
 
@Zacharý I'm not sure. Have a look here under "function array"
 
7:38 PM
fnarray←{       ⍝ Array of functions.
    t←⎕NS''     ⍝ temp space.
    t.f←⍺⍺      ⍝ name operand function in space.
    t,⍵         ⍝ accumulate function array vector.
}
Namespace.
That is actually elegant
 
⋄ ⎕CY'dfns' ⋄ fmat←2 2⍴+fnarray -fnarray ×fnarray ÷fnarray⍬ ⋄ ⎕←fmat.⎕CR'f' ⋄ f 2
 
@Adám
VALUE ERROR
 
⋄ ⎕CY'dfns' ⋄ fmat←2 2⍴+fnarray -fnarray ×fnarray ÷fnarray⍬ ⋄ ⎕←fmat.⎕CR'f' ⋄ ⎕←fmat.f 2
 
@Adám
VALUE ERROR
 
⋄ ⍎'⎕CY''dfns'' ⋄ ⍬⊤⍬' ⋄ fmat←2 2⍴+fnarray -fnarray ×fnarray ÷fnarray⍬ ⋄ ⎕←fmat.⎕CR'f' ⋄ ⎕←fmat.f 2
 
7:43 PM
@Adám

Rebuilding user command cache... done

Real time: 1.041 s
User time: 0.953 s
Sys. time: 0.073 s
CPU share: 98.59 %
Exit code: 0
 
@DyalogAPL :-(
 
Thanks again for the help and the tutorial
Good luck with this problem
 
@Sherlock9 No problem. Ask any time.
 
7:59 PM
@Sherlock9 Notice that APL is usually the "real life" programming language with the shortest solution.
 
XD
That's probably because there's a lot more to it than the symbols would have you think at first
Whereas with Jelly, mind-bending as it also is, is just those 257 symbols
Though I also love Jelly dearly
 
@Sherlock9 Not just. Jelly has many two-letter built-ins.
 
True
 
@Sherlock9 You do know that Jelly is a direct descendant of J, which inn turn is an APL dialect, right?
 
What I mean is that APL has all this system stuff that I have yet to dive into
 
8:03 PM
@Sherlock9 Ah, yes, and OO, and a ton of stuff ships with the install too.
 
Along with classes and control structures, I don't understand yet
Ah. Ninja'd on classes
 
Holy shit
 
Curiously it has Saint Petersburg but not Moscow
 
Moscow's stations may be under a different name
Like how London doesn't directly have a "London Station"
 
Huh. Sorry for assuming
 
One of my the jobs that have been assigned to me is to update the route maps. Super low priority, though.
 
I wonder if the Singapore MRT would be a good addition
 
@Sherlock9 Hm, we should move dfns to GitHub so people could submit pull requests.
 
Sorry, but what do you mean by dfns?
 
8:16 PM
KirovkiyZavod → KirovskiyZavod
Chernychevskaya → Chernyshevskaya
 
I figured dfn was just a defined function
 
 
Ooh
 
@Adám when was that created?
 
@Cowsquack The workspace or the Moscow metro?
 
8:21 PM
tube
 
@Cowsquack Dunno. At least 10 years ago. I just tried it in version 12.1.
@Cowsquack OK, I just checked SVN. It was there in 12.0 too. That's the furthest back I have access to.
 
wow, I'm looking at the train lines for cph and seeing how they've changed over the past ~decade
 
@FrownyFrog OK, thanks, I've fixed those for version 17 and 18.
 
awesome
The capitalization is also inconsistent
(prospekt/Prospekt and ploschad/Ploschad)
 
@FrownyFrog Maybe I should put just the line sources on GitHub for now, so people can help.
 
8:36 PM
people would add all the cities
imagine the bloat
:D
 
@FrownyFrog Not an issue. I just got permission from the CXO, so I'll be doing this soon.
 
CMC: divmod without ÷ or |
 
to base 0 n
 
ngn
@H.PWiz ⊤
 
@ngn Yeah, thats what I had {0⍵⊤⍺}
 
9:07 PM
@H.PWiz How does that work?
To base 0 n?
 
oh it’s weird
 
APL uses mixed base conversion. A leading 0 in the base is used to make it "finish off" the value
 
@H.PWiz So the zero is like the infinity in Wikipedia's first example
 
exactly like infinity
 
Very strange
Does decode have anything like that?
 
9:12 PM
In J, there’s a literal for infinity, I didn’t even know you can put a 0 there for a while
 
@Sherlock9 The leading term in decode doesn't really matter. So it doesn't need it, but 0 does work
 
that's what I thought too, it doesn’t matter
But it clearly makes a difference
 
What difference? Aside from solving a length error
 
That is encode
 
9:15 PM
oh, I was talking about encode
sorry
 
For encode, it only uses numbers less than the base. (except for 0)
 

« first day (511 days earlier)      last day (2149 days later) »