9From [T.J. Corcoran](https://github.com/TJamesCorcoran/nock/blob/master/nock.rb):
14 str.scan(/\+|\=|\?|\/|\*|\[|\]|\d+/).each do |token|
19 ret = arr.is_a?(Array) ? [max_depth(arr[0]), max_depth(arr[1])].max + 1 : 1
24 depth = max_depth(arr)
28 min = 2 ** (depth - 1)
29 max = (2 ** depth) - 1
30 min.upto(max) { |axis|
36 return arr unless arr.is_a?(Array)
39 arr[size - 2] = [ arr[size - 2], arr.pop ]
41 arr = arr.map { |x| norm(x) }
45 arr.is_a?(Array) ? YES : NO
49 raise "not an atom" unless atom.is_a?(Fixnum)
54 raise "not pair" unless arr.is_a?(Array) && arr.size == 2
55 ( arr[0] == arr[1] ) ? YES : NO
58def slot(axis, arr, allow_error = true)
59 raise "axis on atom" unless arr.is_a?(Array)
60 return arr if axis == 1
61 return arr[0] if axis == 2
62 return arr[1] if axis == 3
63 return slot(2, slot(axis/2, arr)) if (axis %2) == 0
64 return slot(3, slot(axis/2, arr))
69 raise "error: nocking an atom" unless arr.is_a?(Array)
76 return [ nock( [ a, [b, c]]), nock( [a, d]) ]
90 nock( [ nock([a, b_primce]), nock([a, c]) ])
105 nock( norm([a, 2, [0, 1], 2, [1, c, d], [1, 0], 2, [1, 2, 3], [1, 0], 4, 4, b]) )
110 nock( norm ([a, 2, b_prime, 1, c]))
115 nock( norm ([a, 7, [[7, [0, 1], b_prime], 0, 1], c]))
120 nock( norm ([a, 7, c, 2, [0, 1], 0, b_prime]))
123 if wut(slot(2,b)) == TRUE
128 nock( norm ([a, 8, c, 7, [0, 3], d]))
132 nock( norm ([a, 10, [b, c]]))
135 raise "error: unknown opcode #{oper.inspect}"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list