« first day (1415 days earlier)      last day (1232 days later) » 

2:45 AM
@Adám still a bit confusing
@dzaima this would be good if it was shown in isometric projection
 
3:05 AM
@Adám is there any crypto library in 'dfns' workspace?
I want to know if there's a function for that in APL
 
@Razetime A function for what, exactly?
 
md5, sha256
 
Those are in DCL.
 
great
 
… but iirc, it still needs tweaking to be run under macOS (as it dates before Dyalog was ported to OS X).
 
3:08 AM
oh
ok, well there's always using shell commands
 
 
2 hours later…
ngn
4:50 AM
@MartinJaniczek impressive!
 
 
2 hours later…
6:23 AM
convenient input format(again) today
 
@ngn this is gonna take a while for me to process
@ngn needs ⎕IO←0 right
 
ngn
@Razetime yes
part2 uses the pattern of starting with an initial state and going through a list of items, transforming the state at every step: ⊃f/(⌽items),⊂initial
f takes the old state as ⍵, the current item as ⍺, and returns the new state
in our case the "items" are a list of booleans indicating the presence of 1..max(a) in the input, and the "state" is the number of paths to the last 3 integers
we start with 0 0 1 because there are no paths to ¯2 and ¯1, and there is a single path to 0 (the empty path)
 
6:39 AM
wow
 
ngn
@Razetime sounds complicated but really isn't
 
doing {(⎕←1↓⍵),(⎕←⍺×+/⍵)}/(⌽a∊⍨1+⍳⊃⌽a),⊂¯3↑1 makes understanding it a lot easier
 
ngn
6:56 AM
@ngn this has much more pleasant syntax in k6, by the way: initial f/items
no reversing, (dis|en)closing, or blowing up vectors is needed
 
(BQN still needs the reverse, but it does have initial f´⌽items)
 
ngn
@dzaima we've talked about this many times, but let me ask again for rhetorical purposes :) why not go left-to-right?
 
@ngn why not go right-to-left? :)
(aka i don't particularly care. left-to-right probably makes more sense)
 
ngn
@dzaima because "/" iterates over a vector, and the vector's indices grow left-to-right
apl/k/bqn expressions are evaluated right-to-left, but that's irrelevant here
@dzaima oh.. sorry, i meant east-to-west and west-to-east :P
 
7:18 AM
Welp, today was a disaster. Spent like 30 minutes on part 1 trying graph-based solutions before realizing you can just sort and look at differences. Then another 90 minutes on part 2 trying partitions/differences/all sorts of things before realizing it's probably a DP problem :|
 
The moment I missed APL for both parts... 2-/ for first, ⍸⍣¯1 (iirc) for second
 
ngn
@voidhawk do you want to look at solutions in apl? (0, 1) if not, how can we welp?
 
@ngn Thanks, I've got it now, just disappointed it sometimes takes me so long to see the obvious
@ngn Btw, are you usually solving the problems when they unlock, or do you wait until a bit later?
 
ngn
@voidhawk it's too early for me (7am), so i often solve them later. but today i was able to get up on time.
 
7:43 AM
@Bubbler hmm, creating a binary array
not sure what that'd be used for
 
That makes DP reduction easier, at least in my formulation
It's like ⊢/⊃{1↓⍵,⍺×+/⍵}/(⊂1 0 0),⍨⌽⍸⍣¯1⊢sorted_array (not tested)
 
ngn
@Bubbler ⍸⍣¯1 - i'm stealing that idea
 
I literally implemented it in another language to make my reduction work
@Bubbler (which assumes both 0 and max+3 are already included in sorted_array)
 
ngn
@Bubbler you don't need max+3 for part2
 
um, yeah, but anyway
(that's just because I reused the pre-processing function from part 1, which includes both ends)
 
8:11 AM
@Bubbler this works
 
Cool, that proves I haven't forgot APL too much
 
ngn
8:58 AM
just came across a very clever part2: github.com/mkst/aoc/blob/master/2020/10.q
d are the deltas, vs means split, prd means product, the rest should be readable
 
9:15 AM
@user13309838 Hi Jens F. If you want to participate here, email me: adam@ with the same domain as www.dyalog.com
 
9:28 AM
@ngn Wow, so it's basically split at threes and handle ones groups separately
 
@rak1507 that part 2 tho
 
Was pretty pleased when I figured it out
 
¯2-/ does reverse subtraction?
nice
 
yeah
 
funny how there's 2 ways to do that
 
9:59 AM
@rak1507 how does that work (p2?)
 
I'm not very good at explaining things but I figured that the only possible difference in paths occur between the 3s, so by getting the length of the consecutive 1s, you can work it out
 
It's very over-optimized for the test case.
 
I was quite lucky there weren't longer sequences of 1s as I worked it out for 1, 2, 3, and 4 manually
Hence 1 1 2 4 7, idk what the next one would be
@Bubbler Maybe but I didn't think of any other way
 
And it won't work if there are any size 2 gaps
 
Are you sure?
 
10:03 AM
Testcase: 0 3 5 7 10
 
Oh
Damn
 
But part 1 hinted that there won't be any size 2 gaps (otherwise it would be asking the product of counts of 1, 2, and 3-gaps)
 
Yeah
×/1 1 2 4 7⌷⍨⊂¯2-/⍸1,~1=¯2-/a I think this works
 
and in AoC no one cares as long as the code gives the correct answer for the single test case given
 
Oh well 1≠ is more sensible
 
10:08 AM
Nope: 0 3 5 6 8 9 12 (the expected answer is 5)
 
5?! I can't really be bothered making it work in general
 
So you need DP (more or less) for generally working solution
 
Yeah :/
I liked using ⌸ for part 1
 
That's good
 
CMC : Implement a Select function equivalent to {(⊂⍺)⌷⍵} without using any primitive functions. E.g. (⍪'babe')≡2 1 2 5 Select ⍪'abcdef'
 
10:16 AM
Without using any primitives? What
 
meaning no []?
 
@rak1507 No, without any primitive functions.
 
or ?
 
Oh, what's left?
 
@Razetime You can use brackets (but I don't think it helps).
@Razetime Nope, no
 
10:18 AM
⍵[⍺;]?
 
@rak1507 Fails on vectors and rank-3 arrays.
 
Hmmm
 
@rak1507 Operators, user-defined functions/operators, and various syntactic elements like assignment parentheses, control structures, guards, error guards, constants, etc.
 
i think i have 23
 
I've got 21.
 
10:22 AM
@Adám surely not using any functions?
 
@dzaima No primitive functions.
I'm down to 18, but a bit hacky.
16 if we allow side effects.
 
@Adám - I'm looking at going back to cleaning up that old APL StarTrek game, now that I'm starting to have time again. As I remember, it was generating random integers by emulating the old BASIC RND() function, but not really. Dyalog's ?⍵ will return a random integer in ⍳⍵ for ⍵≠0, and a random value in the range [0,1) for ⍵=0. Do I get a "better" distribution if I use ?⍵ for ⍵≠0, or ⌊⍵×?0?
 
got 21 18 and also the side-effect-ful 16
 
@JeffZeitlin I don't think it matters. You know you can ask the OS for random numbers, which means sharing the pool with all other applications, and therefore pretty much true randomness?
 
?⍵ would look a lot nicer
 
10:31 AM
Of course. And should be faster too.
 
@Adám - I wasn't aware, but that's definitely something to look int.
 
aplwiki.com/wiki/Dyalog_APL#Functions I am confused on how to do this
 
@Razetime first, don't look at the list of primitive functions for help. :p
 
@JeffZeitlin Just set ⎕rl←⍬2
 
@rak1507 - Using ?⍵ was in fact my first inclination, but then I got to thinking about some of the known flaws in algorithms that generate integers, so it occurred to me to inquire.
 
10:33 AM
@dzaima im confused on how to do it without that lol
 
@Adám /me makes a note
 
14 mins ago, by Adám
@rak1507 Operators, user-defined functions/operators, and various syntactic elements like assignment parentheses, control structures, guards, error guards, constants, etc.
 
@Razetime Well, you're not allowed to use any primitive functions, so that list won't help you. Hint: Other lists might.
@dzaima your 18 hacky?
 
@Adám yep
 
10:36 AM
(finding the 18 requires some specific knowledge, but the 21 is just pure regular APL)
 
@dzaima Right.
Not "pure"?
 
@Adám probably depends on who you ask. Just being safe
 
Ah, you mean because of best scoping practices?
 
10:53 AM
@ngn I solved part 2 like that with 2 differences, I counted runs manually with my eyes
and I used tribonacci numbers, not triangular
both start like 2 4 7
who has input with runs of 5 ?
It think it's tribonacci, so that one's wrong
based on reddit solutions
 
Oh cool, tribonacci, that makes sense
I calculated 1 1 2 4 7 manually
 
⋄3←⍨a
 
Doesn't work
 
11:09 AM
wish it did
 
Would be cool
 
11:33 AM
Here's something weird, a←a∘← then a 10 produces a syntax error about changing nameclass, which is expected, but then if I do a and a 10 again, it doesn't error
 
"do a"?
 
just type 'a'
 
@rak1507 seems the only condition for not erroring is that a was done before the call
 
@rak1507 Ah yes, I know this bug.
 
11:36 AM
 
Haha yeah I tried that too
 
ngn
@FrownyFrog wrong - maybe, even though it always produces correct results. like rak1507's solution, it takes advantage of a fact about the input that wasn't mentioned in the problem description (no 2s and no long runs of 1s). i think aoc's author is to blame - either for not specifying the problem fully or for not generating good enough tests.
 
It's interesting that something∘← works
 
@rak1507 Turn boxing off to get a consistent behaviour (though the bug is NOT in the boxing code!)
 
Weird, how does that work
@ngn It was clear there were no 2s, as for long runs of 1s, that would just have to be calculated, wouldn't add much difficulty
 
ngn
11:38 AM
@rak1507 how was it clear?
 
From the first part
⊃+.×⍣n⍨3 3⍴1 1 1 1 0 0 0 1 0 nice way of calculating tribonacci numbers
 
@rak1507 It is bug 17228 in the interpreter: When the interpreter needs to call a callback function to print something, it should create a ⎕ORed clone of the item to print and pass that, but instead it does an in-place ⎕ORing and so a side effect of printing with a callback is that the item that was printed changes from being a function to be a ⎕OR.
 
Sounds complicated
 
ngn
@rak1507 did you deduce that from the examples and inputs, or does it actually claim it somewhere in the text?
 
Of course it doesn't claim so
 
11:41 AM
I saw that the only differences were 3s and 1s while doing part 1, I guess it isn't that clear but the fact that it only asks for the product of them kinda gives it away
 
but traditionally aoc tends to allow input exploits (and sometimes requires them), so 🤷
 
ngn
i don't like underspecified problems but what can i do
 
12:05 PM
someone on reddit said they had 5 ones in a row
 
Seems like an oversight that different test cases can be easier/harder
 
maybe
 
@ngn the input is as specified as possible since it's given to you. it's your fault you decided to generalize
(but i'd agree that all inputs should have the same max number of 1s in a row)
 
they do
xdd
 
ngn
@dzaima a solution is supposed to work for any valid input, not only mine
 
12:17 PM
@ngn and where is that written?
 
@FrownyFrog If someone had 5, they don't
 
ngn
@dzaima there :)
 
@ngn so my original statement stands
 
ngn
but seriously, what if person A publishes a solution and B tests it and it fails. is it a valid solution?
 
Yes
 
12:21 PM
@ngn it's a valid solution for you, and not a valid one for them
 
ngn
if there weren't a requirement (or expectation) for a solution to work with other peoples' inputs, my solution for day10 would be: 101920 1511207993344 (just print the result)
 
What's the problem with that?
 
@ngn sure, that works
 
It is a valid solution that outputs the right answer. You had to work it out somehow, but the method doesn't really matter
The point of sharing code isn't for other people to verify but more to show their thought process and method (in my opinion anyway)
 
@ngn what if person B's input is 1e40 numbers long?
 
ngn
12:24 PM
@dzaima it won't
 
@ngn why not?
 
ngn
seriously? i have to answer that?
 
@ngn i more expected you to reply with that AOC should've specified a max length. And it surely can, it just could take a while to download
 
ngn
@dzaima yes, ideally max length should be specified too
 
the max length is specified, it is ≢your input
 
ngn
12:29 PM
@rak1507 but your idea of a valid solution is "working only for my input"
 
the important thing is that q is invalid
 
@ngn yeah
 
@ngn specifying the input specification would just be boilerplate and duplicate information to the specification
(furthermore, this works-for-your-input-only mindset goes along with wanting everyone to make their own solution, and teaches to exploit unnamed properties)
 
ngn
@dzaima as if they don't have boilerplate about toboggans and elves and what not..
@dzaima it can be said once about all problems
 
@ngn at least that's not duplicate information
 
ngn
12:35 PM
for instance, i know that in project euler any problem can be solved with ints that fit in 64 bits (except, of course, explicitly bigint problems). they wrote that down once, pertaining to all problems, so you don't have to worry about overflows.
 
@ngn each problem would have a separate reasonable input size limit. Sure, you could say a general maximum of, say, 1mb, but having to write that down somewhere is just stupid
 
ngn
@dzaima it's not stupid if it's useful
 
@ngn i guarantee it's completely useless unless you explicitly want to make use of it :)
 
ngn
@dzaima i can imagine some people solving in c would like to know how large a buffer they should allocate
but in day10 we have a more serious problem than input length - we don't know if an input with six consecutive deltas of 1 is valid or not
 
@ngn project euler often includes "random" numbers, specifying some single input or a bound. If you don't consider those inputs to the same level as AOC, you'll end up allowing a PE solution to be just outputting the constant answer, or need to care about those numbers being >1e100
 
ngn
12:41 PM
@ngn in other words, we can't tell if mkst's and rak1507's solutions are (universally) correct or not
 
@ngn that i'll agree with
 
I don't really care if my solution is universally correct, it worked for my input
 
ngn
@rak1507 sure, you got your stars
 
@rak1507 your solution also worked for my input.
 
As long as I'm not doing anything that is completely suited to my particular input, it seems general enough
 
ngn
12:44 PM
@dzaima yes, that's a problem with PE. it's not clear what should be considered variable "input" and what is just part of the problem.
 
12:56 PM
@dzaima so how does this work?
 
 
1 hour later…
2:04 PM
:56393241
@ngn the "problem" is to get an answer to the question. You deciding to make a program and wanting to generalize it is unrelated
@dzaima (i blame mobile browser chat)
 
ngn
@dzaima for getting PE points - yes. for sharing solutions with other people and for showcase of languages - no.
 
2:22 PM
@ngn again, that's something you decided to do
(AOC has the argument that it has the official reddit solutions pages, but meh)
 
ngn
@dzaima you're making it sound like i'm alone in this. have you looked at the forums after you solve a PE problem? people usually post reasonable, parameterized solutions, not just print(answer)
 
@ngn what people post is how they got to the answer, that it involves code with some parameterization is a side-effect of how the problems are written. If you got to it by just writing a string of digits inside a print statement, thinking of them quickly enough for there to be no need to explain how you arrived at it, that's a valid "solution"
sure, mkst's and rak1507's solutions aren't universal solutions, but they are the way how they arrived at a solution for their specific problem
 
ngn
@dzaima sure. you get a point no matter how you arrive at the answer.
@dzaima but aoc problems have inputs (different for different users, as you know). PE problems are inputless (or: fixed-input).
 
@ngn if you want to differentiate between the two, go ahead
 
ngn
@dzaima ok, i'll try to say it in a different way. in PE everybody has the same input and gets the same output. so if someone's hacky solution miraculously worked, it will work for everyone. this is not true for aoc.
 
2:35 PM
Iverson centenary Google doodle suggestion:
 
@ngn that's because, conceptually, the problem is different for everyone in aoc
 
ngn
@dzaima yes, the input is different for everyone
 
@dzaima "problem" makes that seem weird, "task" may be better
when solving an AOC, you have one task - get an answer, optionally posting how you got it afterwards. Nothing in that specifies anything about the input not being part of the problem statement, any possibility of any other inputs, or even that there are others solving it. Anything other is something you decided to do (even if many others did too), so can't really blame anyone but yourself (or others you're copying)
 
ngn
@dzaima i'm not disputing the solver's entitlement to stars, but the utility of publishing a solution that might not work for everyone
 
@ngn this is mostly for fun and challenge more than anything
It does affect ranking I guess
but really it shouldn't be such an issue that people are making solutions that don't work universally
 
2:47 PM
@ngn the solution might not work for everyone because the task it solves is different, but the goal of showing how you got your answer is completed nonetheless
 
ngn
@dzaima also, i'd blame the author of the problem for not narrowing down the set of valid inputs, rather than the solvers who took advantage of random observations in order to get to the answer sooner
@Razetime i don't really care, it's not the end of the world. it just might be a wrong solution.
 
@ngn I mean, you can blame the author for many, many things - posting at an inaccessible time, writing in only english, not being more suited for $programming_language, encouraging doing $thing_you_dont_like_doing, having a dark-themed site, having the option to show your score to others, having the option to not show your score to others, and many more things.
@dzaima thing is, none of those were the goals of AOC. The goal is to give a fun task, and that's achieved
 
ngn
@dzaima but i don't :) i blame him only for not defining clearly the set of valid inputs, because that matters for the day10 solution.
 
@ngn the point was was to say your blaming him of that is as valid as all those things i mentioned
 
ngn
@dzaima i would argue it's more important, it has direct impact on how you solve the challenge.
about other things: english is an obvious choice. the timing would be inconvenient for someone, no matter which hour you choose. problems so far have been language-agnostic
if this was the acm icpc i would be furious because of the underspecified input
 
2:58 PM
@ngn and input format description & restrictions being in the problem text would waste everyone's time reading something that they absolutely don't care about while doing the single goal of aoc - solve the task
@ngn and that is acceptable, because that actually harms achieving the intended goal. Whereas for AOC the only thing you have to do is get an answer for a specific, known, input
 
ngn
@dzaima just one sentence would have made all the difference: "there are no 2-jolt deltas and no more than 5 consecutive 1-jolt deltas"
 
if you want to achieve something unintended (get a solution that guaranteed works for everyone), you're to blame if that is hard. Same if I wanted to solve acm icpc by doing it on pen&paper - I'd definitely be furious about the number of calculations I'd have to do
@ngn tl;dr: aoc isn't acm icpc; if you want it to be, then look elsewhere
 
ngn
@dzaima that's why i said "if"
 
@ngn but you're still (very?) mildly furious
 
ngn
@dzaima no
 
3:06 PM
reminder that this is an APL chatroom :P
 
@Razetime shh
(gtg)
 
3:48 PM
@Adám How do I use RIDE on the command line?
 
@Razetime as in launch an interpreter connectable to a RIDE GUI?
 
like, use it like a repl
like your dialect
 
@Razetime you don't
 
oh well
 
isn't there that haskell thing that does that or something
 
3:49 PM
@Razetime that's what this was trying to achieve
 
oh ok
 
(should implement a full RIDE protocol connection to my APL app)
@dzaima (heh, i wonder if it'd be feasible to make dzaima/APL present itself as the interpreter for RIDE to connect to :D)
@dzaima first I should port my Sys system from dzaima/BQN though; the current hack of redirection stdout for receiving dzaima/APL output is stupid
 
4:32 PM
 
5:25 PM
@dzaima (or maybe i should make RIDEs protocol my protocol)
 
5:42 PM
This is unrelated, but how do you change the prefix/meta key to something like CapsLock (which doesn't have a character representation) instead of a backtick in RIDE?
 
@user you can't without remapping your keyboard.
 
Ah, that's too bad. Any way to use CapsLock instead of Ctrl using IME?
 
You're on Windows?
And what language keyboard do you use?
 
Yeah, I use Windows, with US English
 
OK, exactly like me, and I have CapsLock as APL key. I'll tell you how:
 
5:53 PM
Oh cool, thanks (it's not a huge deal for me, but I'd just like to use other shortcuts)
 
Run KeyTweak (you can search for it, available from lots of sources) and click CapsLock (key 30). Under "Keyboard Controls", "Choose New Remapping": "Right Alt".
Done.
 
Nice! I'll do that
 
6:45 PM
By the way, it works beautifully, I can now access Ctrl+Z and everything else while using APL. Thanks!
 
@user You bet!
 
 
2 hours later…
8:30 PM
@dzaima trying to, but nothing seems to work (only ever getting first reply message, and starting with RIDE_INIT=HTTP:127.0.0.1:8000 instead of CONNECT makes dyalog segfault when my app is closed (with no responses anyways))
 
ngn
@dzaima why "HTTP:"?
 
@ngn because why not
(it wasn't intended to work, but a segfault is always fun)
SERVE and POLL doesn't even attempt to take any input, but gives the single SupportedProtocols=2
 
Is there a faster alternative to dfns.nats?
Particularly for taking the product of a large number of small ish numbers?
 
ngn
@dzaima have your seen protocol.md?
 
@ngn yeah, but it's pretty much the only thing i've seen (also the haskell thing, but haven't bothered looking thoroughly through it)
 
8:39 PM
@rak1507 There's dfns.big and and Roger's Q.
 
Is dfns.big faster than dfns.nats?
 
I don't remember, but Q is fast, iirc.
 
@Adám big is slower (and dzaima/APL with native bigints destroys both anyways)
 
@dzaima How does dzaima bigints stack up against NARS2000 bigints?
 
@Adám wouldn't know how to test speed in NARS2000
 
8:44 PM
@dzaima Give me an expression to compare, and I'll try it.
 
<moon-child> nars2000 seems to use gmp, and I guess dzaima/apl uses java biginteger?
 
@Adám ×/2000⍴2x for this one. might or might not be worth increasing the number
 
<moon-child> gmp is a lot more optimized
 
@Adám seems to take 4s for 1000 iterations, so 4ms per? so worse than dzaima/APL
 
@dzaima How do I enter a bigint in dzaima?
 
8:48 PM
@Adám suffix L
 
@dzaima ×/200000⍴2x takes just over 3 seconds in NARS2000 and half as long in dzaima.
@Who Hi there. Interested in APL?
 
dzaima/APL is 2x slower for ×/10⍴a with a←3(L/x)*10000 though
 
How do you even run NARS2000? Are you not on Linux?
 
@Adám it runs fine under wine
 
Won't that slow it down?
 
8:55 PM
@Adám i'd expect not much, if at all for anything non-OS-related. My timings roughly match yours too
 
@dzaima To fast to measure.
 
@Adám well, the specific thing i tested was ⍴{⍵⊣×/10⍴a}¨⍳1000
 
Ah, I get NARS2000: 4 secs, dzima: 6 secs
 
@rak1507 (fwiw a better way than ×/ to do that would be to recursively split into two halves and multiply those)
 
I gave up as my algorithm wouldn't even work haha
 
8:59 PM
@Adám i get 3.7 vs 5.4 (was 6.05 on first iteration, but later ones stabilized on 5.4)
 
Stabilises at 4.0 vs 5.6 for me.
 
9:12 PM
@dzaima (oh i was writing the message at an offset of 4, so losing 4 chars and padding with 4 null bytes ಠ_ಠ)
 
9:42 PM
 
ngn
9:54 PM
@dzaima ride on mobile? you should sell this to dyalog :)
 
@ngn hmm
 
has basically nothing to do with the language and only looks like the name
 
10:28 PM
@dzaima OK, but what happens if you enter )ed foo?
 
@Adám nothing yet. i barely parse any of the messages
another question is what happens with the grapher - it needs to evaluate things outside the REPL
but that's a problem for tomorrow
@dzaima adding editors shouldn't be hard though. They already work(ed) for dzaima/APL, just need to bind that to the RIDE protocol interface
@dzaima (a big thing preventing me from just making dzaima/APL interact fully through the RIDE protocol is the native object access problem)
 
@dzaima what is noa?
 
@Adám the grapher just stores a reference to a function object to invoke for getting info. Kind of impossible to store a reference through JSON
@dzaima though i guess i could make a special DyalogFun extends Fun and have some manual pseudo-references (and something similar for arrays). at which point even interop between APL and BQN becomes possible and it would be quite fun to have a single app for Dyalog, dzaima/APL, and dzaima/BQN
 
@dzaima Right, but if hooked up to Dyalog, wouldn't the grapher be disabled anyway, or does dzaima/APL know nothing about graphing?
 
@Adám but i like the grapher :p (it's completely an app thing, unrelated to the actual dzaima/APL interpreter)
 
10:40 PM
@dzaima Ah, ok, I see.
 
11:00 PM
editor; now i'll go sleep
 
@dzaima Sleep well done.
 

« first day (1415 days earlier)      last day (1232 days later) »