This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import collections | |
import subprocess | |
import sys | |
args = 3 | |
size = 3 | |
def f_and(x, y): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⍝ Lamp character ⍝ introduces comments | |
⍝ Assignment arrow ← names things | |
⍝ Braces enclose an anonymous function definition | |
⍝ Inside the braces, ⍵ refers to the function's argument | |
hist ← { | |
n ← ⌈/ ⍵ ⍝ Find maximum value in argument vector | |
a ← n ⍴ 0 ⍝ Allocate a new vector of that length, filled with zeroes | |
a[⍵] +← 1 ⍝ For each item in argument, increment that position in a | |
a ⍝ Return a | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config←30(3 5 11 20 17 19 21 27)(22 8 26 29 4 7 9 1) | |
turn←{s f t←⍺ ⋄ n←⍵+{⍵⊣⎕←'throw ',⍕⍵}?6 ⋄ n>s:⍵ ⋄ (f⍳n)⊃t,n} | |
{}{⎕←config turn ⍵}⍣{⍺=30}1 |