WAR ON RAZE
This is the story of what happened when I went down a rabbit hole.
It starts with k7. If you press Ctrl-] in the k7 WASM console, this appears:
x^x*/:x:2_!100
That's a prime number filter. There are faster ones - kparc.com's x,1_&&/80#'!:'x is beautiful - but this one is really short.
The above k7 snippet:
gets the numbers 0 to 99 ( !100 ) drops the first two ( 2_ ), and assigns that to x ( x: ) gets the product of each element in x with each element of x , forming a table ( x*/:x ) then removes the elements in that table from x ( x^ ). And we have it.
The snippet wasn't always so short: it relies on rank-sensitive 'except' ( ^ ), which Arthur introduced around 1 May 2019. Before then, it was this:
x^,/x*/:x:2_!100
This older version inserts a step between #3 and #4: it merges the result of multiply-each-right ( */: ) into a single list via ,/ , also known as 'raze'.
... continue reading