« first day (1417 days earlier)      last day (1238 days later) » 

12:01 AM
moon-child: Count leading zeros if it's available (it is). Trailing if you use little-endian packing.
 
@Marshall having the vocabulary to describe it that way definitely beats pack left =P
 
@coltim Finally found my writeup on how to do just that. I was going to use it as an example of how often you can do pretty well without needing vector instructions. I think that technique is faster than Cordes' AVX2+BMI2.
Be back in a little while.
 
@Marshall I'll have to look into it! The fastest I've seen was from the Polychroniou code; loading from a lookup table of 256 uint64_t's, building the permutevar8x32 shuffle control by converting from i8s to i32s
 
12:24 AM
Finally did AOC https://github.com/rak1507/Advent-Of-Code-2020-APL/blob/main/Day%2011.dyalog

My code is still terrible, will be improving it tomorrow
 
12:56 AM
In Dyalog 18 with "line edit mode" is there a way to insert a new line in between 2 existing lines?
 
1:10 AM
@coltim That sounds pretty similar to what I did in Dyalog, although I only ever did it with the SSSE3 shuffle (that method was better for 1- and 2-byte data). I think I used the index buffer for 4- and 8-byte data; permutevar8x32 could be faster for 4-byte.
Lemire also has some work on set bit decoding (Where in Dyalog), but his methods use a huge table. That isn't good for an interpreter because you might have relatively small calls to Where or Replicate mixed in with other computation.
 
 
1 hour later…
2:33 AM
@xpqz my Advent of Code day 11 part 1 is gist.github.com/HumanEquivalentUnit/…
takes about 6 seconds, and is not very array-y.
 
@TessellatingHeckler looks nicer than mine :) twitter.com/code_report/status/1337579873376854016
Didn't know about ⌺
although i must say @rak1507 is even nice :o
 
2:49 AM
Somehow skipped over rak's link, yes that's very nice
 
@code_report interesting to use the original game of life
 
@Razetime when i read the problem it seemed very similar. So i just walked through the TryAPL tutorial and modified. Like i said, didnt know about ⌺
 
I've been thinking of gathering the different APL answers to each day of AoC, and that there would be something interesting there
not actually sure what though
 
definitely more interesting
 
 
4 hours later…
 
2 hours later…
9:08 AM
Hi all, I'm currently having fun re-implementing Donald Michie's MENACE in APL.
The Matchbox Educable Noughts and Crosses Engine (sometimes called the Machine Educable Noughts and Crosses Engine) or MENACE was an analogue computer made from 304 matchboxes designed and built by Donald Michie in 1961. It was designed to play human opponents in games of noughts and crosses by returning a move for any given state of play and to refine its strategy through reinforcement learning. Michie did not have a computer readily available, so he worked around this restriction by building it out of matchboxes. The matchboxes used by Michie each represented a single possible layout of a Noughts...
And I am writing a jupyter{bok} as I go along: romilly.github.io/o-x-o/an-introduction.html
2
Feedback welcome!
 
9:30 AM
interesting!
 
 
4 hours later…
Not looking at solutions to prevent spoilers, for some reason I can't get my part 2 to work
It works on the sample so I'm stuck :/
 
ngn
@rak1507 what's your starting waypoint?
 
10 east 1 north
 
ngn
ok, so that's not the problem
@rak1507 do you mind sharing your source even though it's buggy?
 
1:36 PM
@rak1507 add all 7 possible instructions and try again
you might find what's going wrong
 
What do you get for the input 'F10' 'N3' 'F7' 'R90' 'F11' 'S4' 'F3' 'L180' 'W23' 'F2' 'E2'
 
ngn
@rak1507 17 342
 
Huh, same
 
ngn
@rak1507 i think the way you compute w is wrong
 
Probably
 
1:40 PM
what does l do in the assignment to w?
 
That is the rotation
Can someone give me a sample input to test?
 
ngn
@rak1507 i/12 o/12
 
1007 15076
Wow, not even close for the second one
 
only the y value is wrong
 
Ah yeah I found it
 
1:54 PM
@RomillyCocking Nice idea to revisit with APL an important step in machine learning history ! The link to the notebook could be added to aplwiki.com.
 
ngn
2:25 PM
@rak1507 i think i managed to make it work: tio.run/##SyzI0U2pTMzJT///P/…
and simplified part1 a bit
 
 
2 hours later…
4:22 PM
Nice, I managed to do it myself but my code is slow
 
@rak1507 I was pretty happy with my movetable for part1, but I didn't figure out a more array-oriented way to do part 2 github.com/rikedyp/AdventofCode/blob/main/Y2020/Day12.aplf
 
Yeah, I feel like there absolutely must be a more array oriented way but I can't think of it
 
@rak1507 Well for part 1 the translations and rotations are independent, but for part 2 they're not so I'm not sure there is a way
 
Yeah true
 
ngn
@rak1507 if only apl had a forward scan with initial value, part2 could be something like ⊥\
 
4:31 PM
yeah
I don't know much linalg but I wonder if there's a way of representing translations and rotations as matrices and doing a cumulative matrix product like my part 1
Probably not
 
ngn
@rak1507 there should be, but instead of these nice scalar complex numbers you'd have to deal with matrices and a lot of ⊃ and ⊂
 
Yeah, and I don't think there is a way of representing translations as multiplication by a complex number right? At least, not one that you can work out without knowing the result already
 
ngn
@rak1507 translation is +, rotation is ×
 
Yeah :/
 
ngn
but we need both at each step
@rak1507 i'm collecting the best solutions from each day. today i'll throw away mine in favour of something based on yours, it's shorter and more arrayful.
 
4:43 PM
Oh cool, I need to figure out how that works
 
ngn
@rak1507 most of the code is trivial transformations of yours. the last line is emulating the forward scan ⊥\ through the good old pattern 1↓⊃{⍵, ... ⊃⌽⍵}/(⌽vector),⊂initial
 
Makes sense
I'm going to work more on my solution from yesterday as I think I can get part 2 a lot faster
Shame that I was making some progress on it at 2 am last night and forgot to save what I'd done
 
ngn
@rak1507 if you can make it faster than ^this, i'm interested :)
 
No promises...
Ok, that code is insanely fast, no chance
Even that is several times faster than the initial stencil I would do to get the indices
 
ngn
@rak1507 it's twice as fast in ngn/k
(i'm not sure i've gone all the way in both languages)
 
4:58 PM
I don't understand any bit of it, what is the method it uses? I don't see any ⌺s...
 
ngn
@rak1507 no, stencil is each-y and slow
first of all, my solution uses flattened arrays (vectors). 2d coordinates are encoded (⊤) and decoded (⊥) as needed.
it creates an 8×N matrix of neighbours. for part1 these are the immediate neighbours, for part2 - line of sight.
 
How did you go about the line of sight calculations?
 
ngn
N (the number of all cells) is used to indicate missing neighbours and there's a fake cell at index N which has no neighbours and always remains unoccupied.
@rak1507 for those i used the grouping method i mentioned yesterday - i group the cells by their x, y, x+y, and x-y, then sort the groups, then for each group i connect the consecutive positions
 
 
1 hour later…
6:16 PM
@brgal We're not entirely sure yet. Probably just a website banner. I've drafted a code golf competition, but it is close to existing ones, so has the risk of being closed as duplicate. Roger Hui is going to be part of some "panel discussion" I think.
@code_report Yes, it is the <IL> (Insert Line) command, but you have to set a key stroke for it in the settings.
@RomillyCocking Looking very good already. I notice you begin with "It’s not an APL tutorial." but nevertheless, you introduce primitives and terminologies as they come up. Sounds like a tutorial to me…
 
ngn
6:44 PM
@xpqz you solution makes me think it would be fun to arrange for the whole input to be executed with a single ⍎ :)
@ngn how could i have written ¯1 1×⌽ instead of -@0⌽ .. shame on me
 
 
1 hour later…
ngn
7:54 PM
random observation: to compute (x,y) for the four cardinal directions, we can use
x←¯3+5|⎕ucs'ENWS'
y←×3-6|⎕ucs'ENWS'
 
ngn
8:23 PM
 

« first day (1417 days earlier)      last day (1238 days later) »