mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
42 lines
853 B
Plaintext
42 lines
853 B
Plaintext
|
|
// return a list of the fields in a tuple.
|
|
let fields = module{
|
|
tpl = NULL,
|
|
} => {
|
|
let reducer = macro(acc, field, value) => {
|
|
result = acc + [field],
|
|
};
|
|
|
|
let result = reduce reducer.result [], (mod.tpl);
|
|
};
|
|
|
|
// return a list of the values in a tuple.
|
|
let values = module{
|
|
tpl = NULL,
|
|
} => {
|
|
let reducer = macro(acc, field, value) => {
|
|
result = acc + [value],
|
|
};
|
|
|
|
let result = reduce reducer.result [], (mod.tpl);
|
|
};
|
|
|
|
let iter = module{
|
|
tpl = NULL,
|
|
} => {
|
|
let reducer = macro(acc, field, value) => {
|
|
result = acc + [[field, value]],
|
|
};
|
|
|
|
let result = reduce reducer.result [], (mod.tpl);
|
|
};
|
|
|
|
let strip_nulls = module{
|
|
tpl = NULL,
|
|
} => {
|
|
let filterer = macro(name, value) => {
|
|
result = value != NULL,
|
|
};
|
|
|
|
let result = filter filterer.result (mod.tpl);
|
|
}; |