Clue (oklopol)/SKI calculus


 * Back to Clue

deep first ~ {. 1 -> 1             . 2 -> 2 } deep first ~ {:. 1 2] 3] -> 1              : [1 2] -> 1              :. [1 [2 3 -> 1	       : 1 -> 1 } deep first ~ is list?; cons; car; cdr

depth of first ~ {. 0 -> 0                 . 5 -> 0 } depth of first ~ {:. 1 2] [3 4 -> 2                  : [1 2] -> 1                  :. [[[1 2 3] 4] 5] -> 3                   : [[1 2 3] 4] -> 2} depth of first ~ is list?; cons; car; cdr; inc; 0

make singleton ~ {. 1 -> [1]                 . [1 2 3] -> 1 2 3} make singleton ~ cons; []

pair ~ {. 1 2 -> [1 2]       . [3] [4 5] -> 3] [4 5} pair ~ make singleton; cons

more than 3 ~ {. 0 -> 0 } more than 3 ~ {. 1 -> 0 } more than 3 ~ {. 2 -> 0 } more than 3 ~ {. 3 -> 0 } more than 3 ~ {. 4 -> 1              . 5 -> 1 } more than 3 ~ 0; 1

deep first with cutoff ~ {. 0 -> 0                         . [1 0] -> 1                          . 3 2] 1] -> 3                          . [[[5 4] 3] 2] -> 5 } deep first with cutoff ~ {. [[[[1 2]] -> 4                          . [[[[[1 2] 3] 4] 5] 6] -> 4 } deep first with cutoff ~ depth of first; more than 3 deep first with cutoff ~ deep first; 4

ski type? ~ {. 1 -> 0 } ski type? ~ {. 2 -> 0 } ski type? ~ {. 3 -> 0 } ski type? ~ {. [2 1] -> 0            . [2 3] -> 0 } ski type? ~ {. 3 2] 1] -> 0            . [[3 4] 5] -> 0 } ski type? ~ {. [3 2] -> 0             . [3 4] -> 0 } ski type? ~ {. [1 0] -> 1             . [[2 1] 0] -> 2             . [[[3 2] 1] 0] -> 3             . [[[[1 2]] -> 4             . [[[[[1 2] 3] 4] 5] 6] -> 4 } ski type? ~ make singleton; cons; deep first ski type? ~ depth of first; deep first with cutoff; #; 1

cadaar ~ {. [1 [2]] -> [2]         . [3 [2 2 [2 1]] 5] -> [2 2] } cadaar ~ car; cdr

cadar ~ {. 1,[2] -> [2]        . [3 [2 2 [2 1]] 5] -> [2 1] } cadar ~ car; cdr

ski apply ~ {. 3 -> 3            . [2 2] -> [2 2] } ski apply ~ {:. [1 [1 2]] -> 2             : [1 2] -> 2 } ski apply ~ {:. 2 [1 3 2] -> 3             : [1 3] -> 3 } ski apply ~ {:. [3 [2 2 [2 1]] 5] -> [2 1]             : [[2 2] 5] -> 2              : [[2 1] 5] -> 1              : [2 1] -> [2 1]             :. [[[3 1] 1] 1] -> 1              : [1 1] -> 1              : [1 1] -> 1              : [1 1] -> 1 } ski apply ~ {:. [[[[1 2] 1] 2] 1] -> 1              : [[[1 2] 1] 2] -> 1              : [1 1] -> 1             :. [[[[[3 2] 3] 2] 3] 1] -> 3              : [[[[3 2] 3] 2] 3] -> [2 3]              : [[2 3] 1] -> 3 } ski apply ~ ski type? ski apply ~ pair; car; cdr; cadaar; cadar