1var noun = require('./noun.js'),
2 list = require('./list.js'),
4 bits = require('./bits.js'),
10 NounMap = require('./hamt.js').NounMap;
13 var c, d, e, w, x, y, z, p, q, m;
15 m = bits.add(a, i(bits.met(0, b)));
18 while ( zero.equals(bits.cut(zero, x, one, b)) ) {
21 // Sanity check: crash if decoding more bits than available
22 if ( bits.gth(x, m) ) {
23 throw new Error("Bail");
30 return new Cell(one, zero);
38 z = bits.cut(zero, d, x, b);
46 q = bits.cut(zero, z, e, b);
48 return new Cell(p, q);
51function cue_in(m, a, b) {
52 var c,l,u,v,w,y,p,q,d,x;
54 if ( zero.equals(bits.cut(zero, b, one, a)) ) {
57 p = bits.add(c.head, one);
65 if ( zero.equals(bits.cut(zero, l, one, a)) ) {
67 x = bits.add(u.head, c);
69 w = new Cell(u.tail.head, v.tail.head);
70 y = bits.add(u.head, v.head);
79 if ( undefined === x ) {
80 throw new Error("Bail");
83 p = bits.add(two, d.head);
87 return new Cell(p, new Cell(q, zero));
91 return cue_in(new NounMap(), a, zero).tail.head;
95 if ( zero.equals(a) ) {
96 return noun.dwim(1, 1);
99 var b = noun.dwim(bits.met(0, a)),
100 c = noun.dwim(bits.met(0, b)),
103 x = bits.end(zero, u, b),
105 y = bits.lsh(zero, u, a),
108 q = bits.cat(zero, w, z);
109 return noun.dwim(p, q);
113function _jam_in_pair(m, h_a, t_a, b, l) {
114 var w = noun.dwim([2, 1], l),
115 x = bits.add(two, b),
116 d = _jam_in(m, h_a, x, w),
117 y = bits.add(x, d.head),
118 e = _jam_in(m, t_a, y, d.tail.head),
119 z = bits.add(d.head, e.head);
121 return noun.dwim(bits.add(two, z), e.tail.head, zero);
124function _jam_in_ptr(m, u_c, l) {
126 x = bits.lsh(zero, two, d.tail),
127 y = bits.add(two, d.head);
129 return noun.dwim(y, [[y, bits.mix(three, x)], l], zero);
132function _jam_in_flat(m, a, l) {
134 x = bits.add(one, d.head);
136 return noun.dwim(x, [[x, bits.lsh(zero, one, d.tail)], l], zero);
139function _jam_in(m, a, b, l) {
142 if ( undefined === c ) {
145 _jam_in_pair(m, a.head, a.tail, b, l) :
146 _jam_in_flat(m, a, l);
148 else if ( !a.deep && bits.met(0, a) <= bits.met(0, c) ) {
149 return _jam_in_flat(m, a, l);
152 return _jam_in_ptr(m, c, l);
157 var x = _jam_in(new NounMap(), n, zero, zero),
158 q = list.flop(x.tail.head);
160 return bits.can(zero, q);
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