diff --git a/lib/c3.facts b/lib/c3.facts
index 8359316..71b747a 100644
--- a/lib/c3.facts
+++ b/lib/c3.facts
@@ -5,5 +5,5 @@
{C3, :name, "C3"}
{C3, :path, "c3.facts"}
{C3, :function, C3.first}
-{C3.first, :fn, :fn}
-%{hash: 0x55B52EDF4CF3E808}
+{C3.first, :fn, fn ([a | _b]) { a }}
+%{hash: 0x08854B651E330862}
diff --git a/libc3/buf_inspect.c b/libc3/buf_inspect.c
index 4b3361f..9419a4c 100644
--- a/libc3/buf_inspect.c
+++ b/libc3/buf_inspect.c
@@ -223,6 +223,93 @@ sw buf_inspect_fact_spec (s_buf *buf, p_facts_spec spec)
return result;
}
+sw buf_inspect_fn (s_buf *buf, const s_fn *fn)
+{
+ sw r;
+ sw result = 0;
+ if ((r = buf_write_1(buf, "fn ")) < 0)
+ return r;
+ result += r;
+ if ((r = buf_inspect_fn_pattern(buf, fn->pattern)) < 0)
+ return r;
+ result += r;
+ if ((r = buf_write_u8(buf, ' ')) < 0)
+ return r;
+ result += r;
+ if ((r = buf_inspect_fn_algo(buf, fn->algo)) < 0)
+ return r;
+ result += r;
+ return result;
+}
+
+sw buf_inspect_fn_algo (s_buf *buf, const s_list *algo)
+{
+ sw r;
+ sw result = 0;
+ assert(buf);
+ if (! algo) {
+ if ((r = buf_write_1(buf, "{}")) < 0)
+ return r;
+ result += r;
+ return result;
+ }
+ if (! list_next(algo)) {
+ if ((r = buf_write_1(buf, "{ ")) <= 0)
+ return r;
+ result += r;
+ if ((r = buf_inspect_tag(buf, &algo->tag)) < 0)
+ return r;
+ result += r;
+ if ((r = buf_write_1(buf, " }")) <= 0)
+ return r;
+ result += r;
+ return result;
+ }
+ if ((r = buf_write_1(buf, "{\n ")) <= 0)
+ return r;
+ result += r;
+ while (algo) {
+ if ((r = buf_inspect_tag(buf, &algo->tag)) < 0)
+ return r;
+ result += r;
+ algo = list_next(algo);
+ if (algo) {
+ if ((r = buf_write_1(buf, ";\n ")) < 0)
+ return r;
+ result += r;
+ }
+ }
+ if ((r = buf_write_1(buf, "\n}")) < 0)
+ return r;
+ result += r;
+ return result;
+}
+
+sw buf_inspect_fn_pattern (s_buf *buf, const s_list *pattern)
+{
+ sw r;
+ sw result = 0;
+ assert(buf);
+ if ((r = buf_write_u8(buf, '(')) <= 0)
+ return r;
+ result += r;
+ while (pattern) {
+ if ((r = buf_inspect_tag(buf, &pattern->tag)) < 0)
+ return r;
+ result += r;
+ pattern = list_next(pattern);
+ if (pattern) {
+ if ((r = buf_write_1(buf, ", ")) < 0)
+ return r;
+ result += r;
+ }
+ }
+ if ((r = buf_write_u8(buf, ')')) < 0)
+ return r;
+ result += r;
+ return result;
+}
+
sw buf_inspect_ident (s_buf *buf, const s_ident *ident)
{
sw r;
@@ -797,8 +884,7 @@ sw buf_inspect_tag (s_buf *buf, const s_tag *tag)
return buf_inspect_character(buf, tag->data.character);
case TAG_F32: return buf_inspect_f32(buf, tag->data.f32);
case TAG_F64: return buf_inspect_f64(buf, tag->data.f64);
- case TAG_FN:
- return buf_inspect_uw_hex(buf, (uw) &tag->data.fn);
+ case TAG_FN: return buf_inspect_fn(buf, &tag->data.fn);
case TAG_IDENT: return buf_inspect_ident(buf, &tag->data.ident);
case TAG_INTEGER: return buf_inspect_integer(buf, &tag->data.integer);
case TAG_LIST: return buf_inspect_list(buf, tag->data.list);
diff --git a/libc3/buf_inspect.h b/libc3/buf_inspect.h
index d2af0e2..a735cf4 100644
--- a/libc3/buf_inspect.h
+++ b/libc3/buf_inspect.h
@@ -42,6 +42,8 @@ sw buf_inspect_fact (s_buf *buf, const s_fact *fact);
sw buf_inspect_fact_size (const s_fact *fact);
sw buf_inspect_fact_spec (s_buf *buf, p_facts_spec spec);
sw buf_inspect_fn (s_buf *buf, const s_fn *fn);
+sw buf_inspect_fn_algo (s_buf *buf, const s_list *algo);
+sw buf_inspect_fn_pattern (s_buf *buf, const s_list *pattern);
sw buf_inspect_fn_size (const s_fn *fn);
sw buf_inspect_ident (s_buf *buf, const s_ident *ident);
sw buf_inspect_ident_size (const s_ident *ident);
diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index 5e23b9e..75f01d2 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -431,21 +431,26 @@ sw buf_parse_fn (s_buf *buf, s_fn *dest)
assert(dest);
buf_save_init(buf, &save);
if ((r = buf_read_1(buf, "fn")) <= 0)
- return r;
+ goto clean;
result += r;
if ((r = buf_ignore_spaces(buf)) <= 0)
goto restore;
result += r;
fn_init(dest);
- if ((r = buf_parse_fn_pattern(buf, &dest->pattern)) < 0)
+ if ((r = buf_parse_fn_pattern(buf, &dest->pattern)) < 0) {
+ warnx("buf_parse_fn: invalid pattern");
goto restore;
+ }
dest->arity = list_length(dest->pattern);
result += r;
if ((r = buf_ignore_spaces(buf)) < 0)
goto restore;
result += r;
- if ((r = buf_parse_fn_algo(buf, &dest->algo)) <= 0)
+ if ((r = buf_parse_fn_algo(buf, &dest->algo)) <= 0) {
+ buf_inspect_fn(&g_c3_env.err, dest);
+ warnx("buf_parse_fn: invalid program");
goto restore;
+ }
r = result;
goto clean;
restore:
@@ -463,8 +468,9 @@ sw buf_parse_fn_algo (s_buf *buf, s_list **dest)
s_tag tag;
assert(buf);
assert(dest);
+ buf_save_init(buf, &save);
if ((r = buf_read_1(buf, "{")) <= 0)
- return r;
+ goto clean;
result += r;
if ((r = buf_ignore_spaces(buf)) < 0)
goto restore;
@@ -477,10 +483,15 @@ sw buf_parse_fn_algo (s_buf *buf, s_list **dest)
dest = &(*dest)->next.data.list;
if ((r = buf_ignore_spaces(buf)) < 0)
goto restore;
+ result += r;
if ((r = buf_read_1(buf, ";")) < 0)
goto restore;
+ if (! r)
+ break;
+ result += r;
if ((r = buf_ignore_spaces(buf)) < 0)
goto restore;
+ result += r;
}
if (r < 0)
goto restore;
@@ -506,7 +517,7 @@ sw buf_parse_fn_pattern (s_buf *buf, s_list **dest)
assert(dest);
buf_save_init(buf, &save);
if ((r = buf_read_1(buf, "(")) < 0)
- goto restore;
+ goto clean;
result += r;
if ((r = buf_ignore_spaces(buf)) < 0)
goto restore;
@@ -1271,6 +1282,7 @@ sw buf_parse_tag (s_buf *buf, s_tag *dest)
(r = buf_parse_tag_str(buf, dest)) != 0 ||
(r = buf_parse_tag_tuple(buf, dest)) != 0 ||
(r = buf_parse_tag_quote(buf, dest)) != 0 ||
+ (r = buf_parse_tag_fn(buf, dest)) != 0 ||
(r = buf_parse_tag_call(buf, dest)) != 0 ||
(r = buf_parse_tag_ident(buf, dest)) != 0 ||
(r = buf_parse_tag_sym(buf, dest)) != 0)
@@ -1317,6 +1329,14 @@ sw buf_parse_tag_character (s_buf *buf, s_tag *dest)
return r;
}
+sw buf_parse_tag_fn (s_buf *buf, s_tag *dest)
+{
+ sw r;
+ if ((r = buf_parse_fn(buf, &dest->data.fn)) > 0)
+ dest->type.type = TAG_FN;
+ return r;
+}
+
sw buf_parse_tag_ident (s_buf *buf, s_tag *dest)
{
sw r;
diff --git a/libc3/buf_parse.h b/libc3/buf_parse.h
index b659357..35288ba 100644
--- a/libc3/buf_parse.h
+++ b/libc3/buf_parse.h
@@ -65,6 +65,7 @@ sw buf_parse_tag (s_buf *buf, s_tag *dest);
sw buf_parse_tag_bool (s_buf *buf, s_tag *dest);
sw buf_parse_tag_call (s_buf *buf, s_tag *dest);
sw buf_parse_tag_character (s_buf *buf, s_tag *dest);
+sw buf_parse_tag_fn (s_buf *buf, s_tag *dest);
sw buf_parse_tag_ident (s_buf *buf, s_tag *dest);
sw buf_parse_tag_integer (s_buf *buf, s_tag *dest);
sw buf_parse_tag_list (s_buf *buf, s_tag *dest);
diff --git a/libc3/env.c b/libc3/env.c
index 6f61e11..d4e9191 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include "binding.h"
#include "c3.h"
+#include "error.h"
#include "error_handler.h"
#include "frame.h"
@@ -124,43 +125,39 @@ s_tag * env_eval_call (s_env *env, const s_call *call, s_tag *dest)
return result;
}
+s_list * env_eval_call_arguments (s_env *env, s_list *args)
+{
+ s_list **dest;
+ s_list *result;
+ dest = &result;
+ while (args) {
+ *dest = list_new();
+ env_eval_tag(env, &args->tag, &(*dest)->tag);
+ tag_init_list(&(*dest)->next, NULL);
+ dest = &(*dest)->next.data.list;
+ args = list_next(args);
+ }
+ return result;
+}
+
s_tag * env_eval_call_fn (s_env *env, const s_call *call, s_tag *dest)
{
- s_arg *args;
- s_list *call_args;
+ s_list *args;
s_frame frame;
s_fn *fn;
- s_tag tmp;
+ s_list *tmp;
assert(env);
assert(call);
assert(dest);
fn = call->fn;
assert(fn);
frame_init(&frame, env->frame);
- frame.bindings = fn->bindings;
- args = fn->args;
- call_args = call->arguments;
- while (args) {
- if (! call_args) {
- assert(! "env_eval_call_fn: missing argument");
- errx(1, "env_eval_call_fn: missing argument");
- return NULL;
- }
- /* TODO: check type */
- env_eval_tag(env, &call_args->tag, &tmp);
- frame.bindings = binding_new(args->name, &call_args->tag,
- frame.bindings);
- args = args->next;
- call_args = list_next(call_args);
- }
- if (call_args) {
- assert(! "env_eval_call_fn: too many arguments");
- errx(1, "env_eval_call_fn: too many arguments");
- return NULL;
- }
env->frame = &frame;
+ args = env_eval_call_arguments(env, call->arguments);
+ env_eval_equal_list(env, fn->pattern, args, &tmp);
env_eval_progn(env, fn->algo, dest);
env->frame = frame_clean(&frame);
+ list_delete_all(tmp);
return dest;
}
@@ -176,6 +173,130 @@ s_tag * env_eval_call_macro (s_env *env, const s_call *call, s_tag *dest)
return dest;
}
+bool env_eval_equal_list (s_env *env, const s_list *a, const s_list *b,
+ s_list **dest)
+{
+ s_list *tmp;
+ s_list **t;
+ t = &tmp;
+ while (1) {
+ if (! a && ! b) {
+ *t = NULL;
+ goto ok;
+ }
+ if (! a)
+ goto ko;
+ if (! b)
+ goto ko;
+ *t = list_new();
+ if (! env_eval_equal_tag(env, &a->tag, &b->tag, &(*t)->tag))
+ goto ko;
+ a = list_next(a);
+ b = list_next(b);
+ t = &(*t)->next.data.list;
+ }
+ ok:
+ *dest = tmp;
+ return true;
+ ko:
+ list_delete_all(tmp);
+ return false;
+}
+
+bool env_eval_equal_tag (s_env *env, const s_tag *a, const s_tag *b,
+ s_tag *dest)
+{
+ assert(env);
+ assert(a);
+ assert(b);
+ assert(dest);
+ if (a->type.type == TAG_IDENT) {
+ if (b->type.type == TAG_IDENT)
+ warnx("TAG_IDENT = TAG_IDENT");
+ tag_copy(b, dest);
+ frame_binding_new(env->frame, a->data.ident.sym, dest);
+ return true;
+ }
+ if (b->type.type == TAG_IDENT) {
+ tag_copy(a, dest);
+ frame_binding_new(env->frame, b->data.ident.sym, dest);
+ return true;
+ }
+ if (a->type.type != b->type.type) {
+ warnx("env_eval_equal_tag: type mismatch");
+ return false;
+ }
+ switch (a->type.type) {
+ case TAG_VOID:
+ tag_init_void(dest);
+ return true;
+ case TAG_IDENT:
+ error("env_eval_equal_tag: TAG_IDENT");
+ case TAG_LIST:
+ tag_init_list(dest, NULL);
+ return env_eval_equal_list(env, a->data.list, b->data.list,
+ &dest->data.list);
+ case TAG_TUPLE:
+ dest->type.type = TAG_TUPLE;
+ return env_eval_equal_tuple(env, &a->data.tuple, &b->data.tuple,
+ &dest->data.tuple);
+ case TAG_BOOL:
+ case TAG_CALL:
+ case TAG_CALL_FN:
+ case TAG_CALL_MACRO:
+ case TAG_CHARACTER:
+ case TAG_F32:
+ case TAG_F64:
+ case TAG_FN:
+ case TAG_INTEGER:
+ case TAG_PTAG:
+ case TAG_QUOTE:
+ case TAG_S16:
+ case TAG_S32:
+ case TAG_S64:
+ case TAG_S8:
+ case TAG_STR:
+ case TAG_SYM:
+ case TAG_U16:
+ case TAG_U32:
+ case TAG_U64:
+ case TAG_U8:
+ case TAG_VAR:
+ if (compare_tag(a, b)) {
+ warnx("env_eval_compare_tag: value mismatch");
+ return false;
+ }
+ tag_copy(a, dest);
+ return true;
+ }
+ error("env_eval_equal_tag: invalid tag");
+ return false;
+}
+
+bool env_eval_equal_tuple (s_env *env, const s_tuple *a,
+ const s_tuple *b, s_tuple *dest)
+{
+ uw i;
+ s_tuple tmp;
+ assert(env);
+ assert(a);
+ assert(b);
+ assert(dest);
+ if (a->count != b->count)
+ return false;
+ tuple_init(&tmp, a->count);
+ i = 0;
+ while (i < a->count) {
+ if (! env_eval_equal_tag(env, a->tag + i, b->tag + i, tmp.tag + i)) {
+ tuple_clean(&tmp);
+ return false;
+ }
+ i++;
+ }
+ *dest = tmp;
+ return true;
+}
+
const s_tag * env_eval_ident (s_env *env, const s_ident *ident)
{
const s_tag *tag;
diff --git a/libc3/env.h b/libc3/env.h
index 5371f8c..aa368b0 100644
--- a/libc3/env.h
+++ b/libc3/env.h
@@ -23,12 +23,20 @@ void env_clean (s_env *env);
s_env * env_init (s_env *env);
/* modifiers */
-s_tag * env_eval_call_fn (s_env *env, const s_call *call, s_tag *dest);
+s_tag * env_eval_call_fn (s_env *env, const s_call *call,
+ s_tag *dest);
s_tag * env_eval_call_macro (s_env *env, const s_call *call,
s_tag *dest);
+bool env_eval_equal_list (s_env *env, const s_list *a,
+ const s_list *b, s_list **dest);
+bool env_eval_equal_tag (s_env *env, const s_tag *a,
+ const s_tag *b, s_tag *dest);
+bool env_eval_equal_tuple (s_env *env, const s_tuple *a,
+ const s_tuple *b, s_tuple *dest);
s_tag * env_eval_fn (s_env *env, const s_fn *fn, s_tag *dest);
const s_tag * env_eval_ident (s_env *env, const s_ident *ident);
-s_tag * env_eval_progn (s_env *env, const s_list *program, s_tag *dest);
+s_tag * env_eval_progn (s_env *env, const s_list *program,
+ s_tag *dest);
s_tag * env_eval_tag (s_env *env, const s_tag *tag, s_tag *dest);
s_module * env_module_load (s_env *env, s_module *module,
const s_sym *name, s_facts *facts);
diff --git a/libc3/error.h b/libc3/error.h
index 080ee07..9f5f607 100644
--- a/libc3/error.h
+++ b/libc3/error.h
@@ -16,6 +16,12 @@
#include "types.h"
+#define error(message) \
+ do { \
+ assert(! message); \
+ errx(1, "%s: %s", __FUNCTION__, message); \
+ } while (0)
+
void error_print (s_buf *buf, const s_error_handler *error_handler);
void error_print_backtrace (s_buf *buf, const s_list *backtrace);
diff --git a/libc3/facts_cursor.c b/libc3/facts_cursor.c
index 595674b..d41c23d 100644
--- a/libc3/facts_cursor.c
+++ b/libc3/facts_cursor.c
@@ -64,11 +64,11 @@ s_fact * facts_cursor_next (s_facts_cursor *cursor)
if (cursor->node) {
s_fact *fact = cursor->node->fact;
if (cursor->var_subject)
- cursor->var_subject->data.var = fact->subject;
+ *cursor->var_subject = *fact->subject;
if (cursor->var_predicate)
- cursor->var_predicate->data.var = fact->predicate;
+ *cursor->var_predicate = *fact->predicate;
if (cursor->var_object)
- cursor->var_object->data.var = fact->object;
+ *cursor->var_object = *fact->object;
return fact;
}
if (cursor->var_subject)
diff --git a/libc3/frame.c b/libc3/frame.c
index ca2bac3..3283e49 100644
--- a/libc3/frame.c
+++ b/libc3/frame.c
@@ -18,6 +18,11 @@
#include "frame.h"
#include "list.h"
+void frame_binding_new (s_frame *frame, const s_sym *name, s_tag *value)
+{
+ frame->bindings = binding_new(name, value, frame->bindings);
+}
+
s_frame * frame_clean (s_frame *frame)
{
s_frame *next;
diff --git a/libc3/frame.h b/libc3/frame.h
index 6cd6122..3ee0890 100644
--- a/libc3/frame.h
+++ b/libc3/frame.h
@@ -27,6 +27,9 @@ s_frame * frame_new ();
void frame_delete (s_frame *frame);
void frame_delete_all (s_frame *frame);
+/* modifiers */
+void frame_binding_new(s_frame *frame, const s_sym *name, s_tag *value);
+
/* observers */
const s_tag * frame_get (s_frame *frame, const s_sym *sym);
diff --git a/libc3/hash.c b/libc3/hash.c
index d44d6f2..b72e98f 100644
--- a/libc3/hash.c
+++ b/libc3/hash.c
@@ -94,6 +94,14 @@ void hash_update_fact (t_hash *hash, const s_fact *fact)
hash_update_tag(hash, fact->object);
}
+void hash_update_fn (t_hash *hash, const s_fn *fn)
+{
+ const s8 type[] = "fn";
+ hash_update(hash, type, sizeof(type));
+ hash_update_list(hash, fn->pattern);
+ hash_update_list(hash, fn->algo);
+}
+
void hash_update_ident (t_hash *hash, const s_ident *ident)
{
assert(hash);
@@ -124,7 +132,7 @@ void hash_update_list (t_hash *hash, const s_list *list)
{
const s_list *last;
const s8 type[] = "list";
- hash_update(hash, &type, sizeof(type));
+ hash_update(hash, type, sizeof(type));
if (list) {
while (list) {
hash_update_tag(hash, &list->tag);
@@ -191,7 +199,7 @@ void hash_update_tag (t_hash *hash, const s_tag *tag)
hash_update_character(hash, tag->data.character); break;
case TAG_F32: hash_update_f32(hash, tag->data.f32); break;
case TAG_F64: hash_update_f64(hash, tag->data.f64); break;
- case TAG_FN: hash_update_u64(hash, (u64) tag); break;
+ case TAG_FN: hash_update_fn(hash, &tag->data.fn); break;
case TAG_IDENT: hash_update_ident(hash, &tag->data.ident); break;
case TAG_INTEGER:
hash_update_integer(hash, &tag->data.integer); break;
diff --git a/libc3/hash.h b/libc3/hash.h
index 37aa23e..50cd37c 100644
--- a/libc3/hash.h
+++ b/libc3/hash.h
@@ -27,9 +27,10 @@ void hash_update (t_hash *hash, const void *data, uw size);
void hash_update_1 (t_hash *hash, const s8 *p);
void hash_update_bool (t_hash *hash, e_bool b);
void hash_update_call (t_hash *hash, const s_call *call);
-void hash_update_fact (t_hash *hash, const s_fact *fact);
HASH_UPDATE_PROTOTYPE(f32);
HASH_UPDATE_PROTOTYPE(f64);
+void hash_update_fact (t_hash *hash, const s_fact *fact);
+void hash_update_fn (t_hash *hash, const s_fn *fn);
void hash_update_ident (t_hash *hash, const s_ident *ident);
void hash_update_integer (t_hash *hash, const s_integer *i);
void hash_update_list (t_hash *hash, const s_list *list);
diff --git a/libc3/str.c b/libc3/str.c
index a81de3c..c4ad27a 100644
--- a/libc3/str.c
+++ b/libc3/str.c
@@ -85,7 +85,7 @@ s_str * str_init_1 (s_str *str, s8 *free, const s8 *p)
s_str * str_init_alloc (s_str *str, uw size, const s8 *p)
{
assert(str);
- str->free.p = malloc(size);
+ str->free.p = calloc(size + 1, 1);
str->size = size;
str->ptr.p = str->free.p;
if (! str->ptr.p)
@@ -98,7 +98,7 @@ s_str * str_init_dup (s_str *str, const s_str *src)
{
assert(str);
assert(src);
- str->free.p = malloc(src->size);
+ str->free.p = calloc(src->size + 1, 1);
str->size = src->size;
str->ptr.p = str->free.p;
memcpy(str->free.p, src->ptr.p, str->size);
@@ -111,7 +111,7 @@ s_str * str_init_dup_1 (s_str *str, const s8 *src)
assert(str);
assert(src);
len = strlen(src);
- str->free.p = malloc(len + 1);
+ str->free.p = calloc(len + 1, 1);
str->size = len;
str->ptr.p = str->free.p;
memcpy(str->free.p, src, len + 1);
diff --git a/test/facts_with_test.c b/test/facts_with_test.c
index abcdcf3..1de9286 100644
--- a/test/facts_with_test.c
+++ b/test/facts_with_test.c
@@ -116,21 +116,21 @@ void facts_with_test_ ()
&object,
NULL, NULL });
TEST_ASSERT(facts_with_cursor_next(&cursor));
- TAG_TEST_EQ(subject.data.var, tag);
- TAG_TEST_EQ(predicate.data.var, tag + 1);
- TAG_TEST_EQ(object.data.var, tag + 2);
+ TAG_TEST_EQ(&subject, tag);
+ TAG_TEST_EQ(&predicate, tag + 1);
+ TAG_TEST_EQ(&object, tag + 2);
TEST_ASSERT(facts_with_cursor_next(&cursor));
- TAG_TEST_EQ(subject.data.var, tag);
- TAG_TEST_EQ(predicate.data.var, tag + 1);
- TAG_TEST_EQ(object.data.var, tag + 3);
+ TAG_TEST_EQ(&subject, tag);
+ TAG_TEST_EQ(&predicate, tag + 1);
+ TAG_TEST_EQ(&object, tag + 3);
TEST_ASSERT(facts_with_cursor_next(&cursor));
- TAG_TEST_EQ(subject.data.var, tag);
- TAG_TEST_EQ(predicate.data.var, tag + 4);
- TAG_TEST_EQ(object.data.var, tag + 3);
+ TAG_TEST_EQ(&subject, tag);
+ TAG_TEST_EQ(&predicate, tag + 4);
+ TAG_TEST_EQ(&object, tag + 3);
TEST_ASSERT(facts_with_cursor_next(&cursor));
- TAG_TEST_EQ(subject.data.var, tag + 5);
- TAG_TEST_EQ(predicate.data.var, tag + 1);
- TAG_TEST_EQ(object.data.var, tag + 2);
+ TAG_TEST_EQ(&subject, tag + 5);
+ TAG_TEST_EQ(&predicate, tag + 1);
+ TAG_TEST_EQ(&object, tag + 2);
TEST_ASSERT(! facts_with_cursor_next(&cursor));
TEST_ASSERT(! facts_with_cursor_next(&cursor));
facts_with_cursor_clean(&cursor);
diff --git a/test/ic3/fn.out.expected b/test/ic3/fn.out.expected
index 3f20c4b..501a0ae 100644
--- a/test/ic3/fn.out.expected
+++ b/test/ic3/fn.out.expected
@@ -1,3 +1,6 @@
-fn ...
-fn ...
-fn ...
+fn (x) { x }
+
+fn (x, _y) { x }
+
+fn ([x | _y]) { x }
+