« first day (683 days earlier)      last day (1957 days later) » 

2:42 PM
@Adám The HTMLRenderer caught my eye so I tried it with one of my turbo training apps which uses HTML5/JS to drive the graphics with limited success. Does the renderer support sound and websockets?
 
2:57 PM
@Adám Forget the above. My app graphics are running on Dyalog happily talking to my APL driving app via websockets
 
3:20 PM
@Graham I'm happy to hear.
 
 
5 hours later…
7:52 PM
what would be a fast/good implementation of a linked list in apl?
asking specifically for aoc 9b adventofcode.com/2018/day/9 (part b is part a but with 100 times more marbles, so speed really matters)
 
8:14 PM
There's this. Which is something like a linked list in memory. But it might not be very good, as it probably has to copy memory all over the place for simple operations
 
@H.PWiz for AoC 9b you specifically need O(1) inserting & removing of a specific node, and i don't think that's possible with that
 
I don't think linked lists have O(1) insertion/deletion of an arbitrary node, anyway
 
@H.PWiz if you have a pointer to a node, yes they do have O(1)
 
Also, I maybe wrong, but it looks like that wants a doubly linked list aswell
 
@H.PWiz right yeah, that too
 
8:20 PM
So O(1) insertion/deletion at the bit that you are looking at?
 
@H.PWiz with a node object being a pair of the previous and next nodes references, having a reference to a node is enough to be able to remove it/add a node after it
the linked list-ish thing i used for the AoC in java:
https://tio.run/##hVPLbtswELzrK6Y5UQiqKLmqBor66jaHHIscGJFMmMqUQVJKi8Df7iwfsuSghg8Sqd3h7M4s9cpH/vVV/DnshqdOt2g77hx@cm3wXgA56jz3tIy9FthSjj14q83z70dw@@xKvB/WG7RYwcg3rDesLptival@9UKCCD1l2ko1heot08ZDU@C2oeUb7mpar6/LCReWiisvCblg2WohOpnzn4jqOlHdXuB6@Oe83Fb94Ksdte87w1oKJ@qMqy/i7JadxRyAfbEviiLZSKYEE6MA1eDmBkpb5ylEHoX2yVfrywgCVPYvwFnKNClRGfk36FFUS45hExJ7euYRpYnA92nDJtZYvJ3OION@DLoT0sLlmidRluuKPnMAruK7nTSCRE67K1xlHCJ/G7tMkT3eXjSNi7X4QpUzzko/WENcc5MLHcmy2G6qGgwam1lE0L74nKvFV7YhmhdvRnlsPjimc2P/PYB8R06PpSpmORV9VGzMNAv/ot0imkc1d4e4n9DGLKMngWzPFFi0@v1@l
 
8:44 PM
@H.PWiz Well all efficient linkedlists are doubly linked
 
@Quintec not necessarily, since less data stored = more efficiency
though yeah, a non-doubly-linked list feels pretty useless
 
@dzaima O(n) add is just generally bad
 
ngn
8:56 PM
@Cowsquack i would do it with two int vectors for prev and next. amending them with something like prev[i]←j should be fast
 
@ngn oh huh right prev,←... would probably be optimized to not be quite O(N) and the garbage collecting up wouldn't be too big of a problem
 
ngn
@dzaima you don't need to do ,←; you know the number of marbles in advance, so you could allocate a vector of that length in the beginning
 
@ngn oh even smarter :D
 
ngn
@dzaima by the way, ,← often ends up taking O(1) time - if there's free space in memory right after the vector
 
ngn
9:42 PM
part 2 takes ~20s
 
APL day 9 in 30s :D
oh ninja'd
not near java nor C, but hey it works
 
ngn
i wonder, do we really need those prev pointers...
 
@ngn a 7x prev would do, but pretty sure that's needed
or 8x prev, idk
 
ngn
@dzaima 8x prev is (marbleNumber-8)x next
and it's needed only once every 23 steps
 
ngn
10:16 PM
actually, this is much slower :(
 
ngn
10:38 PM
cmc: shortest way to write cn⊢← prev[prev[prev[prev[prev[prev[cn]]]]]] :)
(cn is an int scalar and prev is an int vector, all indices will be within bounds)
 
 
1 hour later…
11:57 PM
@ngn J, 16 bytes: cn=.prev&{^:6]cn
I guess similar bytecount for any(?) APL family
 

« first day (683 days earlier)      last day (1957 days later) »