« first day (1737 days earlier)      last day (904 days later) » 
00:00 - 21:0021:00 - 00:00

12:41 AM
Hello, I started learning APL yesterday, it's a blast
I am trying to write a function to filter a vector for all the elements ≥0
(using trains)
right now i have (⊢/¨0∘≤) but i think it's taking / as reduce not compress
how can I make it not do that
Wait i do this every time i want ⍨
and that's a length error. waugh
Feels like (0∘≤/⊢) should also work but it wants my function to have a left argument ... again i think it's taking / as its operator case, not the dyad function case
 
Right, / isn't straightforward to use as a function in a train
 
@gamma_delta Use ⊢⍤/ instead of /
This makes / be compress and not reduce.
@Miguel Of course. Sorry for being absent all day. Let us know if we can help you with anything.
 
1:15 AM
Ah I see, that's because ⍤ requires the ⍵ to be a function and not an operator @Adám?
(Oh also i recognize you from talks that's cool)
 
@gamma_delta I'd call the right operand ⍵⍵ if anything, but yes, that's how it works.
 
@Adám (0∘≤/⍤⊢) is netting me a syntax error (the function does not take a left argument)?
⍤ gets me a new function, right? doesn't that violate the (f g h) train form?
 
You need ⊢⍤/ instead of / but that's not what you wrote.
So the whole train is (0∘≤⊢⍤/⊢)
 
Ohhh oh ok
i see ⊢⍤ is like uh, ... it sort of packages away the / to make sure it doesn't try to be an operator
Awesome it works!
`(((1+⌈/-⌊/)×2÷⍨⌈/+⌊/)-+/)(0∘≤⊢⍤/⊢)`
the objective being "find the lowest integer greater than zero missing"
this is not actually a correct solution cause it fails if there's more than one missing number but i think it's pretty cool
i would also love to get rid of all the parens by the front but idk how to do that waugh
 
@gamma_delta Post two separate messages instead of embedding newlines, then markdown will work.
 
1:26 AM
Ok
(((1+⌈/-⌊/)×2÷⍨⌈/+⌊/)-+/)(0∘≤⊢⍤/⊢)
aha
 
Isn't that just ⊃⊢~⍨∘⍳1+⌈/
Actually, this assumes at least one non-negative element.
So ⊃⊢~⍨∘⍳1+0⌈⌈/
 
uhhhhh yeah sure
I trust you, but i can't especially read and understand that
 
Want an explanation?
 
Sure. I think i can like figure out the syntax tree, what trains into what and all, but not what it's doing
 
Syntax tree: ⎕←⊃⊢~⍨∘⍳1+0⌈⌈/
 
1:33 AM
@Adám
┌─┴─┐
⊃ ┌─┼────┐
  ⊢ ∘  ┌─┼───┐
   ┌┴┐ 1 + ┌─┼─┐
   ⍨ ⍳     0 ⌈ /
 ┌─┘         ┌─┘
 ~           ⌈
 
It starts by finding the maximum element with ⌈/ then makes sure it is at least 0 with 0⌈ and adds one with 1+. Now we generate all the integers from 1 to that with and removes the argument's elements from the generated integer series with ⊢~⍨. Finally, we take the first (and therefore smallest) element with
 
Cool ok
~ that's soething i'll have to remmeber
 
@gamma_delta You know monadic ~ is logical NOT? I think of dyadic ~ as "but not" as in "all these elements, but not those elements".
 
makes sense
My brain hurts so much but this is so good
 
:-D
APL tends to be addictive. Enjoy with moderation!
 
1:43 AM
Oh while i'm here, i have a bunch of different keyboards on my pc but i only want apl input for english
i don't need mandarin chinese apl, etc
how do i clear those out
 
You might be able to remove them under Windows' Language Settings. Click a language you want to remove the APL layout from, then you should get an Options button which you click to get to a list of Keyboards. Now click the APL keyboard and you get a button that says Remove.
 
The only keyboard i see under Chinese is Microsoft Pinyin
same for other langs
 
Ah, a colleague got this same question in the past week: delete them from the CurrentControlSet keyboard layouts registry list
 
the uh,
the what now
 
2:02 AM
@gamma_delta You should be able to find keys at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts which correspond to the unwanted layouts, and then delete them.
 
isnt the registry the thing if you mess it up it f's up your whole computer
(How much swearing is allowed here)
 
Yes it is. You may wan to create a restore point before messing about.
 
also how do i find out which of all the hexadecimals are which keyboard, and how do i make a restore point, and aaaaaaaaaa
 
Yeah, so instead of that mess, I highly recommend uninstalling the Dyalog IME altogether, and instead using one of my own keyboard layouts: github.com/abrudz/Kbd/releases/tag/v17
My layouts also don't hijack your Ctrl key, so you can keep using it for normal keyboard shortcuts.
 
 
4 hours later…
5:51 AM
how do i read complex trains? ⋄ +/÷1⌈0⊥⍴ (taken from aplcart)
 
@PyGamer0
  ┌─┼───┐
  / ÷ ┌─┼───┐
┌─┘   1 ⌈ ┌─┼─┐
+         0 ⊥ ⍴
 
^ by that i mean the tree representation
 
6:06 AM
@PyGamer0 Each fork-like node (a node without symbol with 3 children) means a 3-train (fork). A single left branch (+) under / means + is the left operand to the operator /.
I read the train from the bottommost rightmost branch: 0⊥⍴ = last item of the shape of the input, 1⌈ = make it 1 if it is zero, +/ sums of the input over the last axis, ÷ divide each sum by the result of 1⌈... which gives "Row averages (0 if none)" (the description on APLcart)
 
⋄ (0⊥) 1 2 4
 
@PyGamer0
SYNTAX ERROR: Missing right argument
      (0⊥)1 2 4
        ∧
 
@PyGamer0 only dzaima/apl allows this
⋄ (0⊥⊢) 1 2 4
 
@Razetime 4
 
has anyone made a physics engine in apl?
 
6:26 AM
yeah for a video game
 
 
1 hour later…
7:35 AM
@Razetime where?
 
it's in a dyalog conference
 
 
4 hours later…
11:30 AM
 
 
2 hours later…
1:30 PM
@Adám Thanks! ATM I'm trying to understand the basics by doing some "simple" exercises from projecteuler.net
 
@Miguel What materials have you been using to learn the basics?
 
tryAPL.org and some of the Wiki's examples
 
OK, so you know about apl.wiki/Learning_resources?
 
@Miguel If you're just starting out, I'd be keen to hear your thoughts about xpqz.github.io/learnapl/intro.html
 
@xpqz Sure, i'll take a look at it later
@Adám yes! I saw the star messages
 
 
2 hours later…
4:00 PM
+/'('∘= - +/')'∘=
How do I make this into a fork of +/'('∘=, -, +/')'∘= ?
IE, count the (s, count the )s, and subtract them?
 
if a dfn was acceptable, {+/(1 ¯1 0)['()'⍳⍵]} would be a nice solution
 
without tons of parens around
Hm
(trans rights!) oh god that's clever
 
anyways, ((+/'('∘=) - (+/')'∘=)) seems to do it
 
Yeah it's just a lot of parens
 
@gamma_delta (based!) i didn't come up with this sadly
 
4:04 PM
parensive
 
just a modification of roger hui's (?) paren nesting formula
it used a scan instead of a reduction
 
A dfn is ok too
but trains are like the cool and hot thing i'm learning about so
 
trains are cool and hot
 
i'm doing aoc 2015 for practice
 
but parens are underrated, especially for fast code
because if you use function composition the interpreter has to derive functions
 
4:06 PM
@KamilaSzewczyk I would steal that solution but i would rather like, use my own code right
but damn if that isn't smooth
Wait i could minimize mine further with the .
like the product, I think
 
i think so, yes
 
@gamma_delta +/⍤=∘'(' - +/⍤=∘')'
 
Yeah cause I need to sub each element, then reduce sum
The ⍤ is like, explicit atop without parens?
 
Yes.
You could also use '('∘= -⍥(+/) ')'∘=
But best is probably -/1⊥'()'∘.=⊢
 
'('∘= +.- ')'∘= is my soln
Oh god decode that's above my pay grade
 
4:10 PM
@Adám huh
 
Meh, 1⊥ is just a trick for +⌿
 
is it?
 
Yes, they mean the same.
 
doesn't it not respect the order of operations or something
 
Huh, no. All functions work the same.
@Adám Hold on, that's wrong!
 
4:13 PM
@Adám this
 
Oh, that's what you mean. Right, but it doesn't matter for integers. 1⊥ is just faster on floats.
-/1⊥∘.=∘'()' is what it should be.
 
@Adám this seems to be the fastest
 
@KamilaSzewczyk Yes, because that does 2n comparisons and n+1 additions.
 
is dyadic lota special-cased for small left arguments
 
I don't think so, but it will probably generate a hash table.
@KamilaSzewczyk How do you like +/¯2+4|'(()))'∘⍳ ?
 
4:20 PM
lovely
 
How come ⎕← isn't printing anything out when i run dyalog -script day01.dyalog
 
What is in day01.dyalog?
 
input← ⊃ ⎕NGET 'day01.txt'

⍝ Part 1
⍝ Find all the '(' and ')', subtract them piecewise, then sum them.
⎕←('('∘= +.- ')'∘=)input

⎕←'aaa'
 
I think you have to pipe that into the interpreter.
 
It says "Dyalog APL could not initialize because the script file could not be loaded"
with dyalog -script < day01.dyalog
 
4:26 PM
Try cat (or type if on Windows) day01.dyalog | dyalog -script
 
Nope, same error
(I'm using cygwin so i have cat)
 
Oh.
 
does it not like cygwin
 
Dyalog 18.0?
 
How do I check?
 
4:27 PM
Start Dyalog and it'll tell you.
 
Ah wait it was in About Dyalog. Version: 18.0.40684.0 64 Unicode
 
@sepp2k Hi there. Interested in APL?
 
@gamma_delta does your file have a trailing newline? Dyalog needs one
 
1. AUGH WHY
2. yes it does
Huh i see something called "dyalogscript" off xpqz.github.io/learnapl/workflow.html
 
That's in 18.2
 
4:33 PM
Dang
 
I know.
@gamma_delta So it seems. I just did dyalog -script day01.txt in 18.0 under WSL and it worked.
 
... huh
I also tried in the normal command prompt (notcygwin) and it also didn't work
 
No, scripting isn't really supported under Windows until 18.2
 
Wow I "love" that, apl has such a "good" user experience
waugh
 
But then with 18.2, we're getting #! scripts, even under Windows (where they just need a .apl extension).
 
4:35 PM
guess i'll get it working on wsl
when is 18.2 going to come out?
 
Hopefully this year. It is in Beta right now.
In 18.2 dyalogscript day01.txt just works. Yay.
 
how does one install apl on wsl
 
It acts as on whichever Linux you have there.
 
apt doesn't seem to have it
 
No, you have to manually download it from dyalog.com/download-zone.htm
 
4:41 PM
ok, dpkg is thinking
dpkg: dependency problems prevent configuration of dyalog-unicode-180:amd64:
dyalog-unicode-180:amd64 depends on libtinfo5; however:
Package libtinfo5 is not installed.

dpkg: error processing package dyalog-unicode-180:amd64 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
dyalog-unicode-180:amd64
aughh i hate dependency management
lets apt-get that and try again
 
Yeah, we're working on eliminating the need for libtinfo5
 
What does that even do
 
We currently use it to query terminal capabilities.
 
ok lets see if that worked at all
Hey i think it worked lets see if that's the answer
 
5:09 PM
@gamma_delta my solution for running APL from files is this: github.com/kspalaiologos/nonalphanumeric-c/blob/main/compile.sh
seems to work fine even with i/o, as evidenced by github.com/kspalaiologos/nonalphanumeric-c/blob/main/llc.apl
 
⎕←(⍳∘¯1 +\∘('('∘= - ')'∘=))input
pog
 
@gamma_delta
VALUE ERROR: Undefined name: input
      ⎕←(⍳∘¯1+\∘('('∘=-')'∘=))input
                            ∧
 
that's part 2 Aww please don't
(@ apl)
 
@gamma_delta You should be able to remove the ⎕← and make the bot retract its response.
 
(⍳∘¯1 +\∘('('∘= - ')'∘=))input
Cool ok so it will look for ⎕←?
 
5:17 PM
Yes. But you definitely should use backticks for code, or you'll one day get bitten by markdown.
 
6:00 PM
apl is addictive hehehehe
i did day2 and i feel very smart
How might I create a mapping? for example mapping '^>v<' to (1 0) (0 1) (¯1 0) (0 ¯1)?
i guess you could do it with some kind of nested [] ⍳?
like {((1 0) (0 1) (¯1 0) (¯ 0 1))[⍵ ⍳ '^>v<']}
aha yeah except i need to flip the ⍳
 
What ⎕IO do you use?
 
@gamma_delta complex nums ftw
 
@gamma_delta ^ Yup: 9 11○0J1*'>v<^'⍳input with ⎕IO←1
⎕←9 11∘○¨0J1*'>v<^'⍳'^>v<'
 
@Adám
┌───┬───┬────┬────┐
│1 0│0 1│¯1 0│0 ¯1│
└───┴───┴────┴────┘
 
6:15 PM
oh, I was meaning just use complex nums instead of converting back to that
 
OK, but we don't know how they are to be used later. Maybe to adjust indices. So actual complex numbers might not work.
 
Oh, I see. Well, I wasn't aware.
 
yeah, fair enough
 
@rak1507 Harder problem: Add . for going out of the image and o for going into the image, thereby moving the problem from 2D to 3D space. How would you solve it now?
 
6:20 PM
ooh, cool
 
@gamma_delta If you get far enough, consider adding your solutions to apl.wiki/Advent_of_Code
 
1-⍨2 2 2⊤whatever
maybe there's something clever in NARS using quaternions haha
 
6:46 PM
is the tryapl bot open source?
 
Yes, everything in it is.
 
I guess we should link to github.com/hyper-neutrino/apl-bot it from APL Wiki and/or its profile.
 
yeah that'd be good
 
Linked from APL Wiki.
@rak1507 Now added source code link to all TryAPL front ends on the Wiki. Thanks!
 
7:15 PM
thanks
 
7:33 PM
@rak1507 Goodness that's a smart idea
@Adám For now I just need to count how many grid squares are visited
 
Right.
 
but i suspect the next problem will be more complex. but still storing it as complex nums is probably a smart idea
how do you type those? like 1j¯1?
 
Yes, that's 1−1i.
 
Is there an established way to do asynchronous http requests in Dyalog?
 
Just run your request in a different thread.
 
7:36 PM
Rightio
 
this is a dumb question but how do you filter an array
for example, filter for only the '^>v<' chars in a string, omit all else
 
⋄ 1 0 1/'abc'
 
@rak1507 ac
 
does that help?
 
@gamma_delta Use intersection
 
7:47 PM
Aha
 
oh, yeah true
the input only has ^>v< though (unless you were asking more generally)
 
8:01 PM
the slight delay on tryapl is bugging me :/
 
Yeah, me too. I'd love to come to the bottom of what causes it.
Hey, let me try a thing.
 
I'm trying to use tryapl to do a thing (might publish it if I ever bother finishing it), and I don't think the delay is a problem but it just makes it feel a little bit slower
 
How does it feel now? Did it get better?
 
wtf! yeah
 
:o
 
8:04 PM
you're a wizard, what did you do?
 
*magic*
 
Can you use a train to do some processing on an input, then pass the original and modified things to another train?
like i'm trying to run the same function on the even and the odd indices of something, then , the results together
 
@gamma_delta f∘g⍨x is x f g x so if you do (train 1)∘(train 2)⍨ thing that should work
 
Cool
 
@gamma_delta Yes, you can always append ⊂,∘⊂ on the left to pass a 2-element vector of original and modified.
 
8:06 PM
I normally use ,⍥⊂ for such a scenario
 
@Adám seriously, what did you do lol
 
How do I keep ⊣/⊢ from being taken as / being reduce?
 
@gamma_delta ⊢⍤/
 
⎕←(⊢,⍥⊂-)⍳9
 
8:08 PM
@awagga
┌─────────────────┬──────────────────────────┐
│1 2 3 4 5 6 7 8 9│¯1 ¯2 ¯3 ¯4 ¯5 ¯6 ¯7 ¯8 ¯9│
└─────────────────┴──────────────────────────┘
 
so ⊣⊢⍤/⊢ ?
 
yes, although the ⊣ and ⊢ aren't necessary, ⊢⍤/ on its own works there
 
i'm so confused
i am going to stop mucking around with trains
 
No, don't!
 
a (⊣⊢⍤/⊢) b = (a⊣b) ⊢⍤/ (a⊢b) = a ⊢⍤/ b
which is a (⊢⍤/) b or a/b in the first place
 
8:10 PM
But when using trains, and needing replicate/compress, simply use ⊢⍤/ instead of /. You don't really need to know how or why that works.
 
There are other tricks you can use depending on the situation, partition, dyadic enclose, index, replace and times come to mind
 
The problem with trains is that atm they're write-only code
({(1+⍵/⍺),(¯1+⍵/1⌽⍺)}∘(2∘|⍳⍤≢)⍨)
i have no idea what the right here means
Also how do you concat two vectors of differing lengths i thought , should work?
... Yeah why does this end with a 0
⎕←({(1+⍵/⍺),(¯1+⍵/1⌽⍺)}∘(2∘|⍳⍤≢)⍨) 1 2 3 4 5
 
@gamma_delta 2 4 6 1 3 0
 
Yeah doing it the dumb way worked
≢∪ ∊ (GetCoords (2|⍳≢input) / input) (GetCoords (~ 2|⍳≢input) / input)
 
I did it by reshaping the input into a 2 by (n÷2) matrix
 
8:22 PM
Oh god welp day 4 needs me to do md5 hashes. does apl come with an md5 hashing algo
 
@gamma_delta no... your best bet is either using ⎕SH or .net stuff I think
 
?
i'm not sure what either of those are
 
⎕SH executes a shell command
 
@gamma_delta How so?
 
That's smart, Rak
 
8:23 PM
@Adám I need to "mine" for a given string with a number appended, such that the resulting md5 hash starts with 5 or more zeroes
> If your secret key is abcdef, the answer is 609043, because the MD5 hash of abcdef609043 starts with five zeroes (000001dbbfa...), and it is the lowest such number to do so.
 
@gamma_delta I was asking why trains are write-only.
 
Oh just because i can't really look at one and deconstruct it
 
@gamma_delta No, but there's DCL.
 
@Adám still curious what you did to speed up tryapl if it's not a secret
 
@gamma_delta It'll come with experience.
 
8:26 PM
How do you install a dyalog library?
 
@rak1507 No secret, but I don't actually know.
 
lol
 
8:41 PM
ok ... i dont understand this
so 'md5sum' ⎕SH '' should ... define a function called md5sum?
and calling it will pipe the argument into its stdin, while it waits for the stdout?
I'm getting a "No such file or directory"
 
@gamma_delta ⎕← {⍵[⍋2|⍵]}1 2 3 4 5 6
 
@awagga 2 4 6 1 3 5
 
Gotta love grade
 
uhh ill take your word for it
 
@awagga That's for sure!
 
8:48 PM
Anyways i really don't understand ⎕SH
 
@gamma_delta You might wanna use ]cd
 
and irritatingly enough i don't think i can use it monadically because i can't figure out how to get text input to md5sum without Windows appending a newline
and the dyad version doesn't make any sense
It finds md5sum fine when used monadicaly
 
@gamma_delta It isn't Windows. You're probably using ⎕NGET which is for text files, not binary data.
 
No I mean like i was trying to do ⎕SH 'echo input | md5sum' but that results in a newline being also piped into md5sum
which ruins the hash
 
Oh.
Do you have the data in a file or in a variable?
 
8:50 PM
Variable, i construct it on the fly
like i have to check many hashes
Oh god if i have to start up the shell a bunch this is gonna be REALLY SLOW
cause they hint it's gonna be in the millions
 
Maybe you should use DCL? It isn't hard to use.
 
I don't know how to install libraries, can you tell me please
 
Nothing to install. Just get the files and ⎕FIX the .dyalog one.
See an example of initialisation here.
 
which .dyalog one? there's many
 
##.TAEL. is just the location to import it to. You can skip that.
@gamma_delta Sorry, Crypt.dyalog
 
8:54 PM
Ok
aa
 
See an example usage here.
 
i don't understand what that means at all
 
00:00 - 21:0021:00 - 00:00

« first day (1737 days earlier)      last day (904 days later) »