News for hackers. Stuff that matters.
Re:AMA: Explaining my 750 line compiler+runtime designed to ... by Avshalom on Sunday March 05, 2017 @08:43PM (#13800144)
ιR creates an array 1...R

1↓ drops the first element of whatever is to the right (1...R)

R← just assigns the thing to the right to R, so now R is a variable containing the integers 2...R

R∘.×R creates a 2d matrix of every element in R multiplied by every other element in R

R∊ takes whatever's to the left (that matrix) and sees if any value in R is in that matrix. it spits out an array that is like 1 0 0 1 0 1 1 0, where the ones correspond to elements in R that are also in the matrix

~ just reverses that list so now we have an array thats like 0 1 1 0 1 0 0 1 which corresponds to elements in R that can't be created by multiplying any two elements of R together

/ goes through and only returns values of R that correspond to those 1's

the flow is like this:

  R←5
  ιR
    1 2 3 4 5
  1↓1 2 3 4 5
    2 3 4 5
  R←2 3 4 5
  R∘.×R
     4  6  8 10 
     6  9 12 15 
     8 12 16 20
    10 15 20 25
  R∊R∘.×R
    0 0 1 0
  ~R∊R∘.×R
    1 1 0 1
  1 1 0 1 / 2 3 4 5
    2 3 5
Re:AMA: Explaining my 750 line compiler+runtime designed to ... by arcfide on Sunday March 05, 2017 @11:03PM (#13800616)
Thanks!