summaryrefslogtreecommitdiff
path: root/vere/pkg/noun/jets/b/flop.c
blob: 0574e4e755ce67e7b68b56e489e0bcdbbd287e0b (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
/// @file

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

#include "noun.h"

u3_noun
u3qb_flop(u3_noun a)
{
  u3_noun i, t = a, b = u3_nul;

  while ( u3_nul != t ) {
    u3x_cell(t, &i, &t);
    b = u3nc(u3k(i), b);
  }

  return b;
}

u3_noun
u3wb_flop(u3_noun cor)
{
  return u3qb_flop(u3x_at(u3x_sam, cor));
}

u3_noun
u3kb_flop(u3_noun a)
{
  u3_noun b = u3qb_flop(a);
  u3z(a);
  return b;
}