summaryrefslogtreecommitdiff
path: root/vere/pkg/noun/jets/b/weld.c
blob: d50fa1c6e77a66301e2f1ebbba49f40240efe4b7 (plain)
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
/// @file

#include "jets/k.h"
#include "jets/q.h"
#include "jets/w.h"

#include "noun.h"

u3_noun
u3qb_weld(u3_noun a, u3_noun b)
{
  u3_noun  pro;
  u3_noun* lit = &pro;

  {
    u3_noun* hed;
    u3_noun* tel;
    u3_noun    i, t = a;

    while ( u3_nul != t ) {
      u3x_cell(t, &i, &t);

      *lit = u3i_defcons(&hed, &tel);
      *hed = u3k(i);
      lit  = tel;
    }
  }

  *lit = u3k(b);

  return pro;
}

u3_noun
u3wb_weld(u3_noun cor)
{
  u3_noun a, b;
  u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0);
  return u3qb_weld(a, b);
}

u3_noun
u3kb_weld(u3_noun a, u3_noun b)
{
  u3_noun c = u3qb_weld(a, b);
  u3z(a); u3z(b);
  return c;
}