« first day (280 days earlier)      last day (1746 days later) » 
13:00 - 19:0019:00 - 00:00

1:13 PM
@Adám is there any way to conveniently put a train in tio?
@EriktheOutgolfer Just like a one-liner dfn For byte counting purposes, it would be neat if TIO would merge the last line of Header with the first line of Code (possibly on condition that the last line of Header ended with )
that's what I'm doing
btw is 10∘⊥2∘⊥⍣¯1⎕UCS a valid train as a whole?
 10 ∘⊥   2 ∘⊥ ⍣ ¯1  ⎕UCS
looks like tio won't accept it that way (takes unicode char array argument, domain error)
      (10∘⊥2∘⊥⍣¯1 ⎕UCS)'abc'
@EriktheOutgolfer No it isn't, because 2∘⊥ is a monadic function.
I use it monadically
@EriktheOutgolfer Try 10⊥2⊥⍣¯1⎕UCS
1:24 PM
@Adám so I don't need to compose?
oh wait
@EriktheOutgolfer No. Compose (with arrays) is only needed to convert dyadic functions to be monadic.
21 hours ago, by Adám
So for a b c d e f only c and e are always called dyadically. b, d, and f are called in whichever way the whole function is called. a is always called monadically.
So 10∘⊥2∘⊥⍣¯1⎕UCS is (10∘⊥) (2∘⊥⍣¯1) (⎕UCS) and the middle one is (failing to be) called dyadically. 10⊥2⊥⍣¯1⎕UCS is (10) (⊥) (2) (⊥⍣¯1) (⎕UCS) so ⊥⍣¯1 and are called dyadically, which is exactly what you want.
@Adám how is the middle one called dyadically though, with what left argument
@EriktheOutgolfer (10∘⊥) (2∘⊥⍣¯1) (⎕UCS) tries (and fails) to call 2∘⊥⍣¯1 with the result of 10∘⊥ as left argument and the result of ⎕UCS as right argument.
I need to practice my recursive thinking lol
@EriktheOutgolfer Recursive? You just need to count from the right.
1:31 PM
also apparently I forgot about (A g h) -> ((A) g (h (⍵))) style trains...
@EriktheOutgolfer Pro tip: Use ]box to compare 10∘⊥2∘⊥⍣¯1⎕UCS with 10⊥2⊥⍣¯1⎕UCS
@Adám tro tip? heh how can you typo p with t
I meant t is 5 keys away from p, so not entirely sure about that typo :p
    ⍺(f g h)⍵ ←→ (⍺ f ⍵) g (⍺ h ⍵)   ⍝ dyadic (fgh) fork
    ⍺(A g h)⍵ ←→    A    g (⍺ h ⍵)   ⍝ dyadic (Agh) fork
    ⍺(  g h)⍵ ←→         g (⍺ h ⍵)   ⍝ dyadic       atop

     (f g h)⍵ ←→ (  f ⍵) g (  h ⍵)   ⍝ monadic (fgh) fork
     (A g h)⍵ ←→    A    g (  h ⍵)   ⍝ monadic (Agh) fork
     (  g h)⍵ ←→         g (  h ⍵)   ⍝ monadic       atop
anyways thanks for the help
@EriktheOutgolfer The above table is from the help system.
@EriktheOutgolfer What about it?
might be helpful for organization if memory doesn't serve if you "name" the "lessons" e.g. "Lesson 1 - Introduction to Arrays in APL"
or I can do it for you if you'd like to
Excellent point. How do I go about renaming conversations?
you can't
you just re-bookmark them :p
I can do it for you if you're lazy ;-)
@EriktheOutgolfer Right. Sure, if you're willing to do it, that'd be really nice of you.
1:39 PM
@Adám just remember to do that the first time for subsequent lessons
@EriktheOutgolfer Sure. Thank you.
@Adám done, but you must delete the other two
@EriktheOutgolfer Done. Thank you. Much better now.
@Adám I did that because, well, outsiders who didn't participate may want to review those lessons too, and that would make them more accessible (note how I included the appropriate key words to each lesson, that's important)
Hello, guys o/
1:48 PM
@EriktheOutgolfer I totally get it, and you're absolutely right. I didn't think it through.
@J.Sallé Hi.
@J.Sallé Up for the lesson tonight?
@Adám for sure, I'll probably have to leave early though. My girlfriend is coming to visit and I'm picking her up later :)
@J.Sallé Nice. You could teach her APL… My wife started learning a little. And my mother learned some from my father.
@Adám wow that's awesome! Unfortunately she's not much into computers/compsci, she's an English teacher hahahahahah
@J.Sallé My wife is a nursery teacher.
@Adám hahahahaha you got lucky, I think. My girlfriend likes videogames and drawing cute animals, not at all into programming :p
2:06 PM
Not long until Morten Kromberg, Roger Hui and Aaron Hsu head off to @FnConf in Bangalore. For the full schedule see https://functionalconf.com/schedule.html
2:16 PM
@Adám is it possible to enlist every possible combination of a given string while keeping it's original order? so for 'abcd' I get 'a' 'b' 'c' 'd' 'ab' 'bc' 'cd' 'abc' 'bcd' 'abcd'
@J.Sallé Those are not the combinations, those are the substrings.
I'm trying to use ∊¨ but it only gives me each element, naturally
@Adám yeah, substrings
@J.Sallé I'm not sure how you define "original order". Is ⊃,/⌽(,\⌽)¨,\⌽'abcd' good?
@Adám I think that works, yeah.
@J.Sallé For strings, you can also use ⎕S with ⊃,/,\¨'.+'⎕S'&'⍠'OM'1⊢'abcd'
2:24 PM
@Adám yup, I just saw your answer to this question
@J.Sallé I'm looking forward to seeing your pure (not ⎕S) APL solution.
@Adám working on it hahahahahah
Can I use the regex '[aeiou]+' with or does that only work with ⎕S?
@J.Sallé Regexes are only for ⎕R and ⎕S. just looks at whether each scalar on the left is a member of the array on the right.
@Adám I imagined so. I'll need to get clever for that. I'm currently trying to use to find where the combinations of vowels are, but I'm having trouble making that function you gave me work properly in a train
If I do f←⊃,/⌽(,\⌽)¨,\⌽ I get a syntax error if I call f 'abcde' D:
and (⊃,/⌽(,\⌽)¨,\⌽)'abcde' raises the same error
2:41 PM
@J.Sallé Every function there is used monadically, so using a train isn't really worth it. But still: f←(⊃,/∘⌽)((,\⌽)¨,\∘⌽)
@Adám I see your point. I'll try to incorporate it into a Dfn
@J.Sallé Just stick an on the right and put the whole thing in braces.
@Adám yup, did just that.
3:13 PM
@Adám I'm trying to check whether the string 'aa' ∊ <anotherString> but that returns 1 1 (because I think it's checking for the scalar 'a' 2 times?), how can I check for the entire string 'aa'?
@J.Sallé 'aa' (∨/⍷) <anotherString>
@J.Sallé … or ∨/ 'aa' ⍷ <anotherString>
@Adám oh nice, thanks!
3:40 PM
So, I have f←{⊃,/⌽(,\⌽)¨,\⌽⍵} and I know 'ae' is in f 'aeiou', but 'ae' (∨/⍷) f 'aeiou' returns 0. What am I doing wrong here?
@J.Sallé Well, if you just want to know if 'ae' is in that list, then (⊂'ae')∊f 'aeiou'.
@Adám good, good. I'm also trying to do something (I don't even know if it makes sense tbqh) like: zip 'aeiou' to itself n times where n = ⍴⍵ (to hopefully get something like 'a' 'e' 'i' 'o' 'u' 'aa' 'ae' 'ai'...). I tried {(,'aeiou')⍣⍴⍵}'abcde' but it doesnt work
I imagine ≢⍵ instead of ⍴⍵ would be the same result btw?
3:59 PM
@J.Sallé You are not using right. It needs to be in the form f⍣(⍴⍵)⊢⍵
@Adám f here being ,? {,⍣(⍴⍵)⊢'aeiou'}'abcdef' raises a rank error. IDK if I made it clear enough, but what I wanted to accomplish is zipping 'aeiou' to itself ⍴<input> times. The logic I'm using here is that if I have every vowel combination up to input size I'll have all combinations that could be in that input?
@J.Sallé What does "zip" mean?
@J.Sallé Btw, the rank error is due to using instead of as cannot take a vector as right operand, and always returns a vector.
um, and are different
@EriktheOutgolfer Is that a question or a statement?
@Adám well in this case, I mean to take 'aeiou' and getting 'a' 'e' 'i' 'o' 'u' 'aa' 'ae' 'ai'... until I have all possible combinations up to input size.
4:14 PM
@Adám a statement
although could be implemented as ⊃⍴
@EriktheOutgolfer Almost. CMC: Find the case where that isn't true.
@Adám empty array?
@EriktheOutgolfer Nope, both give 0
ok opened ride now :p
@J.Sallé Something like {⊃,/{v←'aeiou' ⋄ (,v∘.,⊢)⍣⍵⊢v}¨⍳¯1+≢⍵} ?
4:18 PM
@Adám found it: stuff like ⊂⊂⊂⊂⊂⊂4
@EriktheOutgolfer Uh, or just 4
@Adám lol that uses a whole lot of stuff I wouldn't figure out hahahahahah
I'll try it
@Adám um, is ⊂4 the same as 4?
It works
@EriktheOutgolfer Yes :-(
4:22 PM
so rho is the only way to get wrapped 4 I guess or not?
you need 1⍴4
btw @Adám I consider this kind of a flaw
@EriktheOutgolfer You can do ⊂,4
@EriktheOutgolfer When nesting was added to APL (in the beginning there was only rank, no depth) there were two schools. One held that 4≡⊂4 while the other allowed it to be nested. IBM went with the former, and most vendors followed IBM. IPSA (and J) went with the latter. I agree with you that that 4≡⊂4 is a mistake.
it unnecessary complicates stuff imo
@EriktheOutgolfer The problem arose since IBM introduced stranding (the ability to juxtapose things to create a vector) as an extension of old APL's vector notation: If 'abc' 'def' is (⊂'abc'),(⊂'def) then shouldn't 'a' 'b' be (⊂'a'),(⊂'b') too? Yes, you say. OK, but if (1 2 3)(4 5 6) is (⊂1 2 3),(⊂4 5 6) shouldn't 1 2 be (⊂1),(⊂2) too? (!)
So we conclude that 4 ≡ ⊂4.
@Adám well, wrong path :(
IPSA, on the other hand, did not extend the vector notation to, but instead introduced a "link" primitive (we'll denote it here with ;) so that 1 2 3;4 5 6 is (⊂1 2 3),(⊂4 5 6). The definition of link is {(⊂⍺),⊆⍵}.
4:32 PM
also did they even know that (1) is not a vector
@EriktheOutgolfer Yes, and indeed it isn't.
@Adám at least that's better, except that for and for is kinda, well, nonsensical?
@EriktheOutgolfer No, you need it so you can link multiple items: 1 2 3;4 5 6;7 8 9 Notice that the leftmost ; should NOT enclose its right argument!
@Adám oh
makes sense then
However, "link" doesn't work for all argument the way the juxtaposition conveniently does. Thus (1 2;3 4);(5 6;7 8) gives (using stand notation) ((1 2)(3 4))(5 6)(7 8) and not ((1 2)(3 4))((5 6)(7 8)) like you might expect.
4:39 PM
@Adám I think I'm using wrong. Why does 'a' 'ae' 'ei' ⍷ 'a' 'ae' 'aei' returns 0 0 0 instead of 1 1 0?
Oh nevermind I'm stupid, I should be using instead right?
@J.Sallé Yes.
@EriktheOutgolfer But unfortunate side effect: 'a' 'b' 'c' ≡ 'abc'
that's why concatenation is hard...
But then that would check for the scalars instead of the vectors, so 'aa' ∊ 'a' 'ae' 'aei' still returns 1 1 D: god this is hard
@J.Sallé You need monadic
@Adám okay I'll try fiddling with that
4:45 PM
@J.Sallé If you have a single left arg to you want to enclose. If you have multiple, you don't. That's what "enclose if simple" does.
Same for the right arg.
MemberOf←{(⊆⍺) ∊ (⊆⍵)}
@Adám that's good, I think it's (very, very) slowly happening
@Adám I'd say that the preferable way to concatenate would be {(,⍺),,⍵} (or ,,,, that is)
@EriktheOutgolfer Can you give an example? (Also {(,⍺),,⍵} is not the same as ,,, but rather the same as , (for vectors)
I'll use [...] format
@EriktheOutgolfer Yes; ⎕JSON.
4:53 PM
[1, 2, 3] ; [4, 5, 6] -> [1, 2, 3, 4, 5, 6]
@EriktheOutgolfer That's just ,
[1, 2, 3] ; 4 -> [1, 2, 3] ; [4] -> [1, 2, 3, 4]
1 ; [2, 3, 4, 5, 6] -> [1] ; [2, 3, 4, 5, 6] -> [1, 2, 3, 4, 5, 6]
like, non-vectors be vectored first
@EriktheOutgolfer That's also just ,
I guessed so
but I don't think there's any way to do something like
[1, 2, 3] ; [4, 5, 6] ; [7, 8, 9] -> [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
is there @Adám?
note: NOT [[1, 2, 3], [[4, 5, 6], [7, 8, 9]]]
@EriktheOutgolfer (1 2 3)(4 5 6)(7 8 9) or use link←{(⊂⍺),⊆⍵}
4:56 PM
@Adám I meant builtin primitive function
@Adám I think I made it happen. Thing is, it takes a lot of time for any input over 7 characters
And it fills the WS for anything 9+
5:44 PM
@J.Sallé Well, you are generating HUGE arrays. Have you thought about how many such possible strings you get for length ≤ 7 ?
@Adám it actually works a lot faster in TIO, for some reason, although it runs out of WS for inputs over 8 characters.
@Adám Also, could you proof-read this for me just to check if I said something silly?
@J.Sallé There are +/5*1↓⍳≢⍵ strings!
@Adám lol that's almost 500k strings for 8 characters.
That is a lot of strings hahahah
6:03 PM
@Adám did you get it working? (The tio bot)... I can run the bot from now until 3:20 (EST, 1 hour 20 min from now) if necessary
@SocraticPhoenix I had a meeting, so no. OK, can you put it in here?
TIOBot logged in!
#TIO run shnap println("Hello World")
@Socratic Phoenix
Hello World
#TIO run apl-dyalog +/5*1↓⍳9

Real time: 0.032 s
User time: 0.005 s
Sys. time: 0.016 s
CPU share: 66.25 %
Exit code: 0
#TIO run apl-dyalog ⎕←+/5*1↓⍳9
6:15 PM
#TIO run shnap println("Hello World")
TIOBot logging off!
@SocraticPhoenix Wait, why?
TIOBot logged in!
@Adám I tried to add it to the sandbox to mess with it there but then it stopped working... I guess it can't handle multiple rooms for some reason. Should be back now.
#TIO run apl-dyalog ⎕←+/5*1↓⍳9
@Socratic Phoenix
@SocraticPhoenix It is pretty quick too. Nicely done, sir!
Just a bit confusing that it uses your account. It should be TIOBot
@Adám I made a TIOBot account but it doesn't have 20 rep xD
@Adám Thanks (though the speed is really dependent on TIO and the ChatExchange API, not me)
@SocraticPhoenix I can ask a mod to give it explicit write access here.
@SocraticPhoenix What is its ID?
6:21 PM
#TIO run jelly ⁵
@Erik the Outgolfer
#TIO help
#TIO ?
#TIO jelly ⁵
@Adám @SocraticPhoenix anybody know other commands than "run"?
@EriktheOutgolfer Sure:
#TIO session apl-dyalog
@Adám began session in apl-dyalog
that starts in 7 minutes lol
6:23 PM
#TIO input f←+/÷1⌈≢
Added input to @Adám's session
or something else?
@Adám It should be "TIOBot"
TIO input f 3 1 4 1 5
#TIO session jelly
6:23 PM
@Erik the Outgolfer began session in jelly
#TIO view




Arguments: []
Compiler Flags: []
Command Flags: []
#TIO input 1 + 2
Added input to @Erik the Outgolfer's session
#TIO run
6:23 PM
@EriktheOutgolfer I'll write up a gist
#TIO input f 3 1 4 1 5
Added input to @Adám's session
#TIO submit


Real time: 0.024 s
User time: 0.008 s
Sys. time: 0.013 s
CPU share: 84.51 %
Exit code: 0
#TIO submit
6:24 PM
@Erik the Outgolfer:

Real time: 0.162 s
User time: 0.116 s
Sys. time: 0.011 s
CPU share: 78.46 %
Exit code: 0
#TIO end
#TIO session
@Erik the Outgolfer sorry, but I couldn't find any languages matching "null"
#TIO session jelly
@Erik the Outgolfer began session in jelly
#TIO argument 1 + 2
6:25 PM
@EriktheOutgolfer This is the APL room :P
#TIO arg 1 + 2
Added argument to @Erik the Outgolfer's session
@Adám what are you trying to censor :p also the bot is here not there ;p
#TIO submit
@EriktheOutgolfer It broke and I don't know why
is the bot in here?
6:26 PM
@SocraticPhoenix then restart it
yes the tio bot is here
hrm, well, it's not showing as able to be added to the ACLs
TIOBot logged in!
@ThomasWard it's using my account right now
@SocraticPhoenix Can you switch TIOBot to its own SE account?
#TIO session jelly
@Erik the Outgolfer began session in jelly
6:28 PM
#TIO arg 1 + 2
Added argument to @Erik the Outgolfer's session
#TIO submit
I'll logout and log in to this room as TIOBot
@EriktheOutgolfer Let's try to keep the noise down beginning in 2 mins.
@SocraticPhoenix easier solution: use a different browser
@Adám you should really make a new room for tiobot, it's forcing me to noise, see? ;)
6:30 PM
#TIO run apl-dyalog 2+3

Real time: 0.028 s
User time: 0.007 s
Sys. time: 0.016 s
CPU share: 84.72 %
Exit code: 0
Welcome to everyone here for the APL learning session.
So in the previous lessons we covered APL arrays and how to use functions. Any ideas for today's subject?
@EriktheOutgolfer That's a possibility, though we did touch upon them fairly well during the last session.
If there are no other bids, I'll go through the built-in operators.
I want to know how to enter funny characters into GNU APL, but that might be too basic
6:33 PM
@barrycarter For keyboarding info, have a look here
@Adám Thanks!
also here we usually do dyalog apl
We could also spend some time on keyboard mnemonics.
@EriktheOutgolfer Yeah, but we don't have to, all APLs are on-topic (maybe not Jelly).
I used to use APL+ before I came to Dyalog.
Oh, OK, I'm using GNU APL, and it's command line-- no fonts... but I also have tryapl.org in another tab
@Adám that's why I said "usually" ;) (also Jelly isn't an APL but instead an APL 2nd-generation child)
6:35 PM
@barrycarter You can download Dyalog APL for free. It has nice GUI.
OK, let's go through some operators.
The first operator is /. It is a monadic operator which derives an ambivalent function.
@All please interrupt if I use terminology you don't understand!
@Adám What's an ambivalent function?
monadic = takes one argument?
@DJMcMayhem A function which can be called monadically or dyadically.
Like f(x) or f(x,y) in mathematics?
E.g. - is ambivalent. Monadically it is negate, dyadically it is subtraction.
6:37 PM
/.5 is -5 but /. 5 6 is -1?
@barrycarter Yes, but dyadic APL functions are infix. (Usually called operators in other languages)
Am I allowed to ask why they didn't just use "-"?
5 /. 6 is -1 then?
@barrycarter Uh, that doesn't look like APL to me.
OK, NM, I don't know enough APL.
@barrycarter yeah not sure what you mean here
6:39 PM
@barrycarter - is indeed negate/subtraction in APL. I was just giving an example of an ambivalent function in APL.
Oh, got it. So now you're describing the "/" operator?
Yes. +/ is a derived ambivalent function. The monadic function is plus-reduction (i.e. sum) and the dyadic function is windowed sum, as in sliding windows of size (shorthand for "left argument")
#TIO run apl-dyalog ⎕←+/3 1 4 1 5
#TIO run apl-dyalog ⎕←2 +/ 3 1 4 1 5
4 5 5 6
6:41 PM
#TIO run apl-dyalog ⎕←3 +/ 3 1 4 1 5
8 6 10
Neat, n+/ means apply + to each subsequence of n elements
@barrycarter Yep.
What does 3-/ do? Subtraction isn't associative.
#TIO run apl-dyalog ⎕← 3-/ 1 2 3 4 5
6:43 PM

Real time: 0.027 s
User time: 0.005 s
Sys. time: 0.019 s
CPU share: 86.85 %
Exit code: 0
@barrycarter You need ⎕← in front to print.
@barrycarter f/ and n f/ inserts the function f in between the elements and whatever that evaluates to, is the result.
#TIO run apl-dyalog ⎕← 3-/ 1 2 3 4 5
2 3 4
So 1 - 2 - 3 is 2?
So, because functions in APL are right-associative, -/⍵ (this is a shorthand which means the monadic form of -/) is alternating sum.
@barrycarter Yes, 1 - (2 - 3)
6:45 PM
Ah, got it. Not left to right.
f/⍵ is called Reduce because it reduces the rank of its argument by 1.
So, if I apply it to a matrix, I'll get back a vector?
@barrycarter Yes. Even if the function you provide does not "combine" its arguments.
#TIO run apl-dyalog ⎕←{'(',⍺,⍵,')'}/'Hello'
Here, the function I gave concatenates its arguments and parentheses.
If you look really carefully, you'll see that there is a space in front of the leftmost (
This is APLs way to indicate that the array (a character vector) is enclosed. I.e. it returned ⊂'(H(e(l(lo))))'
6:50 PM
#TIO run apl-dyalog ⎕←{'(',⍺,⍵,')'}/ h e l l o
line(1,0) : error AC0505: error (VALUE ERROR) executing line "⎕←{'(',⍺,⍵,')'}/ h e l l o"
Complete: 1 error.
DOMAIN ERROR: There were errors processing the script
 '#'⎕NS ⎕FIX'file:///home/runner/.bin.tio.dyalog'

Real time: 0.030 s
User time: 0.004 s
Sys. time: 0.022 s
CPU share: 87.13 %
Exit code: 0
#TIO run apl-dyalog ⎕←(⊂'(H(e(l(lo))))') ≡ {'(',⍺,⍵,')'}/'Hello'
@barrycarter You need singlequotes around the string.
Sorry, I'll stop doing that.
6:51 PM
@barrycarter No, it is fine.
Shouldn't it be the same as applying the function to 'h' '... oh wait
#TIO run apl-dyalog ⎕←{'(',⍺,⍵,')'}/ 'h' 'e' 'l' 'l' 'o'
@barrycarter Yes, "strings" in APL are just vectors of scalar characters. See Lesson 1.
We can also apply reductions to higher-rank arrays:
#TIO run apl-dyalog ⎕←3 4⍴⍳12
1  2  3  4
5  6  7  8
9 10 11 12
#TIO run apl-dyalog ⎕←+/3 4⍴⍳12
6:53 PM
10 26 42
#TIO run apl-dyalog ⎕←+2/3 4⍴⍳12
1 1  2  2  3  3  4  4
5 5  6  6  7  7  8  8
9 9 10 10 11 11 12 12
Notice how the rank went down from 2 to 1 (i.e. matrix to vector). Reductions lower the rank.
#TIO run apl-dyalog ⎕←2+/3 4⍴⍳12
 3  5  7
11 13 15
19 21 23
6:54 PM
N f/ is called N-wise reduce, and does not lower the rank. As barrycarter neatly showed.
So it only reduces when each row is reduced to a single element.
#TIO run apl-dyalog ⎕←4+/3 4⍴⍳12
Ah! Using 4+ is different from just doing +
@barrycarter No, N-wise reduce does not lower the rank.
@barrycarter Right. This may be handy in golfing…
Notice that / goes along the trailing axis, i.e. the it reduced the rows of the matrix. It has a twin, which goes along the first axis, i.e. the columns of a matrix.
why just golfing? n-wise reduce can remove the need to map reduce after making pairs first, and that can get tedious
6:57 PM
@EriktheOutgolfer Well then, all the more power to you.
#TIO run apl-dyalog ⎕←+⌿3 4⍴⍳12
15 18 21 24
So these are the column sums.
What if you have a rank 3 tensor... can you specify which sum you want?
@barrycarter Yes, you can use f/[dimension]
13:00 - 19:0019:00 - 00:00

« first day (280 days earlier)      last day (1746 days later) »