1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/// @file
#include "jets/k.h"
#include "jets/q.h"
#include "jets/w.h"
#include "noun.h"
u3_noun
u3qc_lsh(u3_atom a,
u3_atom b,
u3_atom c)
{
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3m_bail(c3__fail);
}
else if ( !_(u3a_is_cat(b)) ) {
return u3m_bail(c3__fail);
}
else {
c3_g a_g = a;
c3_w b_w = b;
c3_w len_w = u3r_met(a_g, c);
if ( 0 == len_w ) {
return 0;
}
else if ( (b_w + len_w) < len_w ) {
return u3m_bail(c3__exit);
}
else {
u3i_slab sab_u;
u3i_slab_init(&sab_u, a_g, (b_w + len_w));
u3r_chop(a_g, 0, len_w, b_w, sab_u.buf_w, c);
return u3i_slab_mint(&sab_u);
}
}
}
u3_noun
u3wc_lsh(u3_noun cor)
{
u3_atom bloq, step;
u3_noun a, b;
u3x_mean(cor, u3x_sam_2, &a,
u3x_sam_3, &b, 0);
u3x_bite(a, &bloq, &step);
return u3qc_lsh(bloq, step, u3x_atom(b));
}
u3_noun
u3kc_lsh(u3_noun a,
u3_noun b,
u3_noun c)
{
u3_noun d = u3qc_lsh(a, b, c);
u3z(a); u3z(b); u3z(c);
return d;
}
|