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

14:42
@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?
14:57
@Adám Forget the above. My app graphics are running on Dyalog happily talking to my APL driving app via websockets
15:20
@Graham I'm happy to hear.
 
5 hours later…
19:52
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)
20:14
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
20:20
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
20:44
@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
ngn
20:56
@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
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
ngn
@dzaima by the way, ,← often ends up taking O(1) time - if there's free space in memory right after the vector
ngn
ngn
21:42
part 2 takes ~20s
APL day 9 in 30s :D
oh ninja'd
not near java nor C, but hey it works
ngn
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
ngn
@dzaima 8x prev is (marbleNumber-8)x next
and it's needed only once every 23 steps
ngn
ngn
22:16
actually, this is much slower :(
ngn
ngn
22:38
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…
23:57
@ngn J, 16 bytes: cn=.prev&{^:6]cn
I guess similar bytecount for any(?) APL family

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