« first day (1785 days earlier)      last day (887 days later) » 
00:00 - 17:0017:00 - 22:00

12:05 AM
@Adám but i'm using power.
 
@Fmbalbuena Yeah, so?
 
@Adám ⋄Fac←{×⌿⍵}⋄Fac 1⋄Fac 7
 
@Fmbalbuena
1
7
 
(not working when the parameter is 0)
 
You're missing one thing here.
@Fmbalbuena Try reading your code and you'll see what's missing.
 
12:08 AM
oh
⋄Fac←{×⌿⍳⍵}⋄Fac 1⋄Fac 7
 
@Fmbalbuena
1
5040
 
Done
⋄Fac←{×⌿⍳⍵}⋄Fac 1⋄Fac 0
 
@Fmbalbuena
1
1
 
why returns 1, @Adám?
 
@Fmbalbuena A. Because that's the correct answer for the factorial of 0, and B. because that's the identity element for multiplication.
@Fmbalbuena This solution is perfect
 
12:10 AM
⎕←⍳0
 
@Fmbalbuena Response looks like a 1-by-0 matrix.
 
⍳0 is the list of the first 0 integers.
Same as 0⍴0
 
⎕←*⌿0⍴0 0
 
@Fmbalbuena 1
 
but whyyyy?
 
12:12 AM
Because x¹=x for all x
So too ×/0⍴0 gives 1 because 1×x=x for all x.
And +/0⍴0 gives 0 because 0+x=x for all x.
-/0⍴0 and ÷/0⍴0 give 0 and 1 because x-0=x and 0÷1=x for all x.
 
⋄FNC←{⍺+⍵*2}⋄FNC⌿1 2 3 4 5
 
@Fmbalbuena 5.074254262E11
 
@Adám Can you teach one more command?
 
I'll teach you TWO for the price of one!
 
@Adám ?
 
12:16 AM
Dyadic is the maximum of its arguments: ⋄ 3⌈4 ⋄ 5⌈5 ⋄ ¯3⌈¯1
 
@Adám
4
5
¯1
 
that's easy to learn
 
Can you guess the symbol for the dyadic minimum function?
 
 
You got it!
So I taught you one and you learned TWO!
 
12:17 AM
⋄ 4⌈⌊5 Errors?
 
@Fmbalbuena 5
 
No, but monadic means something else.
It means "floor" or "round down".
Can you guess the symbol for "ceiling" or "round up"?
 
I forgot what is monad and others.
@Adám
 
@Fmbalbuena Indeed. I did it again, didn't I?
@Fmbalbuena Dyadic=2 arguments. Monadic=1 argument.
 
@Adám others?
 
12:19 AM
Niladic=0 arguments.
 
one more?
 
Nope.
Do you want a task?
 
@Adám yep
 
Given a list of numbers, find the largest element. E.g. Max 3 1 4 1 5 9 2 should give 9.
 
@Adám f←{⌈⌿⍵}
 
12:22 AM
Amazing! One more task?
 
@Adám yes but a bit harder.
 
OK, given a list of numbers, find its range, i.e. the difference between the largest and the smallest element. E.g. Range 3 1 4 1 5 9 2 should give 8 and Range 42 42 42 should give 0.
 
i can't solve with one tradfn.
 
You can easily solve it with a single dfn (=lambda).
 
@Adám wdym?
 
12:26 AM
I'm telling you that you have all the info and skills to solve this task using a single lambda.
I can give you some hints if you need it.
 
a hint?
 
You already solved the problem of finding the maximum of a list. Try finding out how to get the minimum, and then subtracting those two formulas.
 
@Adám f←{⌈⌿⍵-⌊⌿⍵}
 
Good.
This gives the right result, but for the wrong reason. Can you see why?
Do you want a hint?
 
yes
 
12:34 AM
Every APL function takes as right argument, everything to its right.
 
no idea what testcase is but... f←{(⌈⌿⍵)-⌊⌿⍵}
 
Yes, now you nailed it! Well spotted.
 
testcase?
 
There are no test cases for which your previous solution would fail.
 
what array will fail this function?
 
12:37 AM
None.
 
but why this is incorrect?
 
I didn't say it was. I said your original solution gives the right result.
 
ok. wait...
 
But the problem was that you were subtracting the minimum from the entire array, instead of subtracting it from the maximum.
 
wait... i found something weird.
 
12:39 AM
Sure?
 
seems sus.
 
Heh. It is the comment symbol.
It looks like a little lamp or LED to enlighten you.
 
difference between = and ?
 
= maps over elements like + and × while compares entire arrays: ⋄ 1 2 3=1 4 3 ⋄ 1 2 3≡1 4 3 ⋄ 1 2 3≡1 2 3
 
@Adám
1 0 1
0
1
 
12:44 AM
Similarly for vs
 
or converts int to str?
 
Not exactly. executes a string as APL code, while formats any array as a character array.
 
what command converts int to str?
 
will do that, as an int is an array, and a str is a character array.
⋄ '12' ≡ ⍕12
 
@Adám 1
 
12:47 AM
⍕ or ⍕?
 
What?
 
⍕ formats any array as a character array. ⍕ will do that, as an int is an array, and a str is a character array.
 
I don't understand what you're asking.
 
⋄⍕12
 
@Fmbalbuena 12
 
12:49 AM
i don't understand
 
Note that the default display form for 12 and '12' are identical.
 
@Fmbalbuena You just entered the same character twice
 
Here, consider this: ⋄ 4⍴12 ⋄ 4⍴⍕12
 
@Adám
12 12 12 12
1212
 
@Fmbalbuena You understand ^?
 
12:52 AM
@Adám but the difference is ⎕←(12,6)≡'12','6'⋄⎕←12,5
 
@Fmbalbuena
0
12 5
 
@Adám yep
 
OK, good.
 
xpqz's book?
 
Is highly recommended.
 
12:54 AM
do you have xpqz's book?
 
You mean a link to it?
 
@Adám or picture.
 
It doesn't really exist in physical form unless you print the PDF. You can find a link to it in this room's starred messages or at apl.wiki/Learning_resources#For_programmers_unfamiliar_with_APL.
 
@Adám can you teach me Making AI (for some game boards) in APL whin i learn a lot of APL?
 
@Fmbalbuena Maybe, but let's see once you've learned a lot more APL.
 
12:59 AM
@Adám I forgot which link generates random problems.
 
You can always find it by going to aplcart.info and clicking Quiz at the bottom.
 
monad is 2 args?
 
No, 1. You can maybe remember it like a monologue is one person speaking while a dialogue is a conversation between two people.
MONO=1, DIA=2.
MONadic vs DYAdic.
 
Niladic?
 
0, like nil=nothing or nul(l).
 
1:07 AM
@Adám one task?
 
You want another task from me?
 
Yes
 
OK, I'll give you one that is a little tricky. Given a list of numbers, count how many are greater than 3.
E.g. 3 1 4 1 5 should give 2 (namely 4 and 5).
 
Remember, sum is +⌿
 
Yes.
 
1:10 AM
@Adám f←{+⌿2≠⍵⌈2}
 
That's pretty clever, but it fails on 2.5 1 4 1 5
Let me know if you need a hint.
 
@Adám ⋄f←{+⌿3≠⍵⌊3}⋄f 3 2 1 not working.
 
@Fmbalbuena 2
 
hmm... i found.
 
You need to use a function I've not taught you, but you should be able to guess.
 
1:14 AM
change "≠" to "=", correct?
 
No.
 
@Adám f←{+⌿3=⍵⌊3}
 
Ooh, nice, that actually works.
 
That's "greater than or equal to 3", not "greater than 3"
 
However, there's a much better way.
@Bubbler Oh, you're right.
 
1:17 AM
oh sorry
@Adám f←{+⌿⍵>3}
 
@Fmbalbuena That's what I wanted to see! ♥
 
@Adám i like one more task because APL fun.
 
OK, given a list of numbers, answer 1 if all are greater than 3 but 0 otherwise. E.g. 3 1 4 1 5 should give 0 while 31 41 5 should give 1.
 
@Adám f←{×⌿⍵>3}
 
Amazing. You're really picking this up very well.
 
1:23 AM
but is there shorter way to do "AND" in APL?
 
There's a separate symbol for AND () but it is dyadic, so you still would need
 
ok i learned 3 commands. Can you remember the commands that i learned?
 
More or less.
 
@Adám but why?
 
Because my memory isn't perfect.
 
1:27 AM
@Adám but nevermind i will ask commands that i remembered.
 
 
7 hours later…
8:48 AM
Any idea what would stop me from creating a workspace? I get the following error:
)save myws
Can't save - file could not be created.
 
./myws could be write-protected or a directory.
Or open somewhere else.
 
Hmm, that doesn't seem to be it. C;losed the interpreter and tried again:
)save definitelynewfile
Can't save - file could not be created.
 
Do you have write access to the current dir?
 
      ]FILE.CD
/
Ok, in my humble opinion, that's a mental default :)
 
I don't know why that would be the default startup dir, but I'll log an issue.
 
8:53 AM
I swear it used to default to the user's homedir. I've installed, uninstalled, and re-installed various beta versions recently, not sure if that could be the cause.
 
Do you want to investigate a bit before I log?
 
I've noticed is that Dyalog's recommended uninstall mechanism (drag the folder into the trash) probably isn't sufficient/correct from 18.1 and onwards -- if I have 18.1 and then install 18.2, followed by uninstalling 18.2, all the dyalogscript stuff is gone, and no longer works in 18.1.
This to me suggests it won't be possible to run multiple versions of dyalog moving forward.
I wonder if the default directory is a symptom of the same thing.
 
Can you describe the whole thing to support@dyalog.com?
 
Sure.
Aha - it leaves a hanging symlink.
(py39) Stefans-MacBook-Pro:d stefan$ file /usr/local/bin/dyalogscript
/usr/local/bin/dyalogscript: broken symbolic link to /Applications/Dyalog-18.2.app/Contents/Resources/dyalog/Samples/scripts/bin/dyalogscript
I can fix that manually for sure.
It also leaves a broken link /usr/local/bin/dyalogscript.bash
Resetting those two manually fixes it.
 
 
1 hour later…
10:43 AM
@Adám DOMAIN ERROR - or with quotes, NONCE ERROR
 
@RikedyP Well, then you've got issues to log.
 
@Adám Oh seems to be when trying to copy HttpCommand (which I should probably keep at root level rather than within kit)
before I log issue, can you think of any reason why ⎕NS shouldn't copy httpcommand class?
 
No.
 
ty
 
@PyGamer0 I just realised that |∘| and |⍤| and ⌊○⌊ are all valid APL functions.
 
10:48 AM
@Adám wait, what (the first two are composed right?)
what about the last one?
 
Yeah, the first is equivalent to {⍺←⊢ ⋄ ⍺||⍵} and the second to {⍺←⊢ ⋄ |⍺|⍵} and the third to {⍺←⊢ ⋄ (⍺⌊⍵)○(⍺⌊⍵)}.
@RikedyP Assign to Geoff and maybe mark as related to the ref-as-left-arg issue.
4 messages moved from The Nineteenth Byte
 
@Adám Well I tried to do it fresh and couldn't repro outside of my aoc project
 
:-/
 
11:05 AM
how were the APL glyphs chosen?
 
@PyGamer0 Many were based on TMN or derived from it. Iverson seems to have come up with some, and some where chosen by Quaker consensus when Iverson's notation was linearised into what became APL. Newer symbols were chosen with or without consensus by various vendors.
 
11:30 AM
how do i map a char vector to numbers, say 'ABCD' to 1 2 3 4 so 'ABBCCDDCAC' becomes 1 2 2 3 3 4 4 3 1 3
 
⋄ ⎕A⍳'ABCD'
 
@Razetime Did you forget to add backticks around your code (`⋄ code`)? You can edit your message and I will edit my reply.
 
      ⋄ ⎕A⍳'ABCD'
1 2 3 4
 
@Razetime 1 2 3 4
 
 
1 hour later…
12:38 PM
If you did today's AoC without help from dfns, you're a hero.
 
12:51 PM
@xpqz what is dfns?
 
@dzaima TLDR
 
@Fmbalbuena a namespace of various useful functions
 
ok.
 
RGS
@xpqz Is it that difficult to implement a graph search algorithm..?
(SPOILER, dont' read this message if you want to solve day 15 all by yourself)
Not sure if you used a super-duper specialised version of something, but Dijkstra's algorithm shouldn't be _that_ hard to implement, right..?
 
I've made a few over the years (A*, bfs, dijkstra) in APL. Never pretty.
 
RGS
Right.
 
@Adám i want to solve a problem
 
1:19 PM
but then you also need my heapq and dict implementations....
 
@PyGamer0 Any particular one?
 
@Adám no, just a simple CMC
 
@PyGamer0 Have you looked at problems.tryapl.org?
 
yes
 
And?
 
1:22 PM
i solved one problem
 
Is there a reason not to continue with those? They are all simple.
 
ok
 
@xpqz how fast is it?
 
@PyGamer0 You can still ask for feedback on your solutions to those problems here.
 
@Adám ok
 
1:24 PM
@dzaima Passably. Around 30s on my 2016 i5:
]runtime "day15 d2"

* Benchmarking "day15 d2"
              (ms)
 CPU (avg):  30768
 Elapsed:    31793
 
@xpqz ah. So not competing with my 0.4s in BQN :)
 
RGS
@dzaima damn
 
Wait. wat?
 
RGS
@xpqz thanks
 
Is there a trick shot here?
 
1:26 PM
how does this look? 2021 P1: {len←≢⍵⋄count←+/⍵∊'CG'⋄100×count÷len}
 
@xpqz no. Just a regular dijkstra/breath first search, just without any ¨iness, and all long array operations. code
 
@PyGamer0 That's fine, although I really don't think the len variable adds any clarity.
 
(my initial solution was 50 seconds though)
 
@dzaima I bow to your superior cerebral fitness. I should really study bqn at some stage.
 
it should port to APL just fine (and be many times faster in Dyalog, because nearly everything used in my solution isn't yet vectorized in CBQN)
 
RGS
1:33 PM
@dzaima Does that mean you are going to port it? (☞゚ヮ゚)☞
 
ugh fine
 
RGS
😆
You can't come in here flexing, and expect people to not want to learn something new.
 
true
 
@dzaima interesting -- all the time is taken by the wpath function -- curious that something that established would have its arse kicked so comprehensively.
 
@Adám 2021 P2: {l←1+≢⍺⋄i×l>i←⍺⍳⍵}
 
1:38 PM
Hmm, it goes via the full spanning tree. That would be why.
 
@PyGamer0 That's fine, although can you think of a way to get rid of 1+ (which then also means that the variable l is a but unnecessary)?
 
@Adám {i×(≢⍺)≥i←⍺⍳⍵}?
 
Very nice.
 
ok how do i make that into a tacit function?
 
⍳(⊣×≤∘≢)⊣
This isn't a 1:1 translation.
 
1:45 PM
ok
why cant i turn boxing on with options on TryAPL
 
Because it is always on.
 
@Adám but i want to change it to display trains=parens
 
You can't, sorry.
Use an installed system, e.g. TIO.
 
but i dont have a language bar there(on android)
 
Even using my bookmarklet?
 
1:52 PM
@Adám wait let me try that
 
here ya go:
https://dzaima.github.io/paste/#0jVIxS8NQEN7zK24zJdWXBxYUFFxEXHRxK06vDoHXUEwkQ8yiUNrgK4oUV6mDpQgO1UVwqf/kfonfe0lL3YTwuPvuu7vv7sKj8fEp9@9DT@Pl/sP2ziabKY/GVypZTLm8hXlydHi2IVtbUbwhPa0po0SRok50mRCyiM3b@udFcZS6QO4RZVxOHGk4YfMJQOsaaVZ@qqmOaw03UXU4PAhhkS@DVDfQ44Nk@PMUCMdakiRl8KySZdHFlHI/1WxmmENy/xFdGhWweF/zmyH99UEPaQkUGDJDTzbzVHuF53lJetFbDVVZiWqrc3hxpwogEUABBVaQDThca6AUkF3mXSkoRx6ojhh3QOs6WrzXc@O3uwJ0i3RFvDYqD2a2RBMFfGQMXsl3O2vw8NlKFnhWJZXV7O6gnXI2L3m4727wVSCKq7oW0on6TlTNlsHuNdZSiTUz0RQ@lzfYv0NQPRD4K8y8Ra3/1f0F#APL
3
 
RGS
@dzaima Thanks! Is it fast? :P
 
How fast is it?
 
RGS
Wait, I thought you said it didn't use ¨? :P
 
@RGS not using ¨ is very different from not using ¨y things
@xpqz 130ms
the three ¨es in step are all on 4-item arrays
 
RGS
1:59 PM
Now I'll study your code :D Thanks for sharing!
 
@dzaima 95ms if the file reading is extracted out and ⎕←s removed
 
@Adám it working manually, when i paste the js
in the url bar
 
But not as a bookmark?
@Razetime Maybe you could amend APLgolf to (optionally) show a language bar?
 
@Adám no the bookmark doesnt work, i cant click on it
 
:-(
 
2:07 PM
@Adám that would also be a good option
 
@dzaima +←1 thanks for sharing this!
 
@dzaima Impressive indeed.
 
2:54 PM
@dzaima would you mind outlining what the five global state variables represent? (ll w sc c dirs)
 
RGS
I'll guess that dirs gives some “directions”. Maybe the costs of the 4 neighbours of each position, or something like that.
 
3:05 PM
@xpqz ll - flat vector of the costs; dirs - lists represending all neighbord for each item in ll; w - width (also height); sc - current "score" of a cell; c - the list of indices that need to be updated in the next step
in step, p - previous score for each current cell; nd - neighbor indexes; n new score for the cell; m - mask of improved scores
 
Thank you.
 
(sc has a ≢llth element that's always the maximum value, and dirs references that for the things that'd otherwise go out-of-bounds)
 
@Adám yeah i can, the lb bookmarklet doesn't really change the functionality so it should be simple
 
3:30 PM
@Adám added
 
@Razetime How to activate?
 
@dzaima That's cool. Best dijkstra I've seen in apl.
 
 
1 hour later…
4:46 PM
@Adám i want to learn a command.
 
4:59 PM
@Fmbalbuena Monadic reverses its argument. E.g. ⎕←⌽'Hello'
 
@Adám olleH
 
00:00 - 17:0017:00 - 22:00

« first day (1785 days earlier)      last day (887 days later) »