Commit a906ccc736b402e9261370621d97c1362a2f4f01

Thomas de Grivel 2024-02-16T11:48:30

wip macros

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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
diff --git a/.ic3_history b/.ic3_history
index 6e3377b..0206db5 100644
--- a/.ic3_history
+++ b/.ic3_history
@@ -1,29 +1,3 @@
-234
-123/123
-123/ 123
-do
-1
-1 + 1
-2 + 2
-end
-hello = fn (name) { "Hello, #{name} !" }
-m = macro (name) { "Hello, #{name} !" }
-m(plop)
-m(:plop)
-m("plop")
-m = macro (x) { quote 1 + unquote x }
-plop = 2
-m(plop)
-name = "Thomas"
-m = macro (x) { quote 1 + unquote x }
-m(name)
-name
-name = "Thomas"
-m = macro (x) { quote 1 + unquote x }
-m(name)
-name = "Thomas"
-m = macro (x) { quote 1 + unquote x }
-m(name)
 name = "Thomas"
 m = macro (x) { quote 1 + unquote x }
 m(name)
@@ -97,3 +71,29 @@ m(name)
 m("Plop")
 m(^ name)
 m = macro (name) { quote "Hello, " + unquote name + " !" }
+name = "Plop"
+^ name = plop
+plop
+name
+name = "Plop"
+m = macro (name) { quote "Hello, " + unquote name + " !" }
+m(name)
+m(^name)
+m(^ name)
+m = macro (name) { quote "Hello, " + unquote name + " !" }
+name = "Plop"
+m(name)
+m = macro (name) { quote "Hello, " + unquote name + " !" }
+name = "Plop"
+m(name)
+m(^ name)
+name
+type(name)
+m(name)
+n = "123"
+m(n)
+n
+m(n)
+m = macro (name) { quote "Hello, " + unquote name + " !" }
+n = "123"
+m(n)
diff --git a/README.md b/README.md
index 25c43e2..66092e9 100644
--- a/README.md
+++ b/README.md
@@ -293,6 +293,7 @@ Script interpreter. Works the same as ic3 but is not interactive.
      - height function `(TAG_VOID: 0, TAG_TUPLE: max(height(tuple->tags)))`
      - has_ident
      - collect_idents
+   - DONE pin operator (for pattern matching)
    - DONE macros
    - modules
      - defmodule
diff --git a/libc3/env.c b/libc3/env.c
index f92a8b0..c821ba7 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -274,7 +274,7 @@ bool env_eval_call_resolve (s_env *env, s_call *call)
   const s_tag *value;
   assert(env);
   assert(call);
-  if ((value = frame_get(env->frame, call->ident.sym))) {
+  if ((value = env_frames_get(env, call->ident.sym))) {
     if (value->type == TAG_CFN) {
       call->cfn = cfn_new_copy(&value->data.cfn);
       return true;
@@ -290,8 +290,8 @@ bool env_eval_call_resolve (s_env *env, s_call *call)
   return call_get(call, &env->facts);
 }
 
-bool env_eval_equal_list (s_env *env, const s_list *a, const s_list *b,
-                          s_list **dest)
+bool env_eval_equal_list (s_env *env, bool macro, const s_list *a,
+                          const s_list *b, s_list **dest)
 {
   s_list *a_next;
   s_list *b_next;
@@ -310,13 +310,13 @@ bool env_eval_equal_list (s_env *env, const s_list *a, const s_list *b,
     if (! b)
       goto ko;
     *t = list_new(NULL);
-    if (! env_eval_equal_tag(env, &a->tag, &b->tag,
+    if (! env_eval_equal_tag(env, macro, &a->tag, &b->tag,
                              &(*t)->tag))
       goto ko;
     a_next = list_next(a);
     b_next = list_next(b);
     if (! a_next || ! b_next) {
-      if (! env_eval_equal_tag(env, &a->next, &b->next,
+      if (! env_eval_equal_tag(env, macro, &a->next, &b->next,
                                &(*t)->next))
         goto ko;
       goto ok;
@@ -334,7 +334,7 @@ bool env_eval_equal_list (s_env *env, const s_list *a, const s_list *b,
   return false;
 }
 
-bool env_eval_equal_map (s_env *env, const s_map *a,
+bool env_eval_equal_map (s_env *env, bool macro, const s_map *a,
                          const s_map *b, s_map *dest)
 {
   const s_map *c;
@@ -363,7 +363,7 @@ bool env_eval_equal_map (s_env *env, const s_map *a,
     j = 0;
     while (j < b->count) {
       if (! compare_tag(a->key + i, b->key + j)) {
-        if (! env_eval_equal_tag(env, a->value + i, b->value + j,
+        if (! env_eval_equal_tag(env, macro, a->value + i, b->value + j,
                                  &tmp)) {
           return false;
         }
@@ -380,9 +380,8 @@ bool env_eval_equal_map (s_env *env, const s_map *a,
   return true;
 }
 
-// TODO: pin operator
-bool env_eval_equal_tag (s_env *env, const s_tag *a, const s_tag *b,
-                         s_tag *dest)
+bool env_eval_equal_tag (s_env *env, bool macro, const s_tag *a,
+                         const s_tag *b, s_tag *dest)
 {
   bool is_unbound_a;
   bool is_unbound_b;
@@ -395,7 +394,7 @@ bool env_eval_equal_tag (s_env *env, const s_tag *a, const s_tag *b,
   tag_init_void(&tmp_a);
   tag_init_void(&tmp_b);
   is_unbound_a = a->type == TAG_IDENT;
-  is_unbound_b = b->type == TAG_IDENT;
+  is_unbound_b = ! macro && b->type == TAG_IDENT;
   if (is_unbound_a && is_unbound_b) {
     err_write_1("env_eval_equal_tag: unbound equal on both sides: ");
     err_inspect_ident(&a->data.ident),
@@ -414,24 +413,26 @@ bool env_eval_equal_tag (s_env *env, const s_tag *a, const s_tag *b,
     frame_binding_new(env->frame, b->data.ident.sym, dest);
     return true;
   }
-  if (a->type == TAG_CALL &&
+  if (! macro &&
+      a->type == TAG_CALL &&
       a->data.call.ident.module == &g_sym_C3 &&
       a->data.call.ident.sym == &g_sym_operator_pin) {
     if (! env_eval_tag(env, &a->data.call.arguments->tag, &tmp_a))
       return false;
-    if (! env_eval_equal_tag(env, &tmp_a, b, dest)) {
+    if (! env_eval_equal_tag(env, macro, &tmp_a, b, dest)) {
       tag_clean(&tmp_a);
       return false;
     }
     tag_clean(&tmp_a);
     return true;
   }
-  if (b->type == TAG_CALL &&
+  if (! macro &&
+      b->type == TAG_CALL &&
       b->data.call.ident.module == &g_sym_C3 &&
       b->data.call.ident.sym == &g_sym_operator_pin) {
     if (! env_eval_tag(env, &b->data.call.arguments->tag, &tmp_b))
       return false;
-    if (! env_eval_equal_tag(env, a, &tmp_b, dest)) {
+    if (! env_eval_equal_tag(env, macro, a, &tmp_b, dest)) {
       tag_clean(&tmp_b);
       return false;
     }
@@ -488,22 +489,22 @@ bool env_eval_equal_tag (s_env *env, const s_tag *a, const s_tag *b,
     return true;
   case TAG_LIST:
     tag_init_list(dest, NULL);
-    return env_eval_equal_list(env, a->data.list, b->data.list,
+    return env_eval_equal_list(env, macro, a->data.list, b->data.list,
                                &dest->data.list);
   case TAG_MAP:
     dest->type = TAG_MAP;
-    return env_eval_equal_map(env, &a->data.map, &b->data.map,
+    return env_eval_equal_map(env, macro, &a->data.map, &b->data.map,
                               &dest->data.map);
   /*
   case TAG_STRUCT:
     dest->type = TAG_STRUCT;
-    return env_eval_equal_struct(env, &a->data.struct_,
+    return env_eval_equal_struct(env, macro, &a->data.struct_,
                                  &b->data.struct_, &dest->data.struct_);
   */
   case TAG_TUPLE:
     dest->type = TAG_TUPLE;
-    return env_eval_equal_tuple(env, &a->data.tuple, &b->data.tuple,
-                                &dest->data.tuple);
+    return env_eval_equal_tuple(env, macro, &a->data.tuple,
+                                &b->data.tuple, &dest->data.tuple);
   case TAG_CALL:
   case TAG_QUOTE:
   case TAG_ARRAY:
@@ -524,7 +525,7 @@ bool env_eval_equal_tag (s_env *env, const s_tag *a, const s_tag *b,
   case TAG_SYM:
   case TAG_VAR:
     if (compare_tag(a, b)) {
-      warnx("env_eval_compare_tag: value mismatch");
+      err_puts("env_eval_compare_tag: value mismatch");
       return false;
     }
     tag_init_copy(dest, a);
@@ -536,7 +537,7 @@ bool env_eval_equal_tag (s_env *env, const s_tag *a, const s_tag *b,
   return false;
 }
 
-bool env_eval_equal_tuple (s_env *env, const s_tuple *a,
+bool env_eval_equal_tuple (s_env *env, bool macro, const s_tuple *a,
                            const s_tuple *b, s_tuple *dest)
 {
   uw i;
@@ -550,7 +551,8 @@ bool env_eval_equal_tuple (s_env *env, const s_tuple *a,
   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)) {
+    if (! env_eval_equal_tag(env, macro, a->tag + i, b->tag + i,
+                             tmp.tag + i)) {
       tuple_clean(&tmp);
       return false;
     }
@@ -572,8 +574,6 @@ bool env_eval_fn_call (s_env *env, const s_fn *fn,
   assert(env);
   assert(fn);
   assert(dest);
-  frame_init(&frame, env->frame);
-  env->frame = &frame;
   clause = fn->clauses;
   if (arguments) {
     if (fn->macro || fn->special_operator)
@@ -585,10 +585,15 @@ bool env_eval_fn_call (s_env *env, const s_fn *fn,
       }
       args_final = args;
     }
-    /* FIXME: bindings go through clauses */
-    while (clause && ! env_eval_equal_list(env, clause->pattern,
-                                           args_final, &tmp))
+    while (clause) {
+      frame_init(&frame, env->frame);
+      env->frame = &frame;
+      if (env_eval_equal_list(env, fn->macro || fn->special_operator,
+                              clause->pattern, args_final, &tmp))
+        break;
+      env->frame = frame_clean(&frame);
       clause = clause->next_clause;
+    }
     if (! clause) {
       err_puts("env_eval_call_fn: no clause matching.\nTried clauses :\n");
       clause = fn->clauses;
@@ -601,25 +606,31 @@ bool env_eval_fn_call (s_env *env, const s_fn *fn,
       err_inspect_fn_pattern(args);
       err_puts("\n");
       list_delete_all(args);
-      env->frame = frame_clean(&frame);
       return false;
     }
   }
+  else {
+    frame_init(&frame, env->frame);
+    env->frame = &frame;
+  }
   if (! env_eval_block(env, &clause->algo, &tag)) {
     list_delete_all(args);
     list_delete_all(tmp);
     env->frame = frame_clean(&frame);
     return false;
   }
+  list_delete_all(args);
+  list_delete_all(tmp);
+  env->frame = frame_clean(&frame);
   if (fn->macro) {
-    if (! env_eval_tag(env, &tag, dest))
+    if (! env_eval_tag(env, &tag, dest)) {
+      tag_clean(&tag);
       return false;
+    }
+    tag_clean(&tag);
   }
   else
     *dest = tag;
-  list_delete_all(args);
-  list_delete_all(tmp);
-  env->frame = frame_clean(&frame);
   return true;
 }
 
@@ -632,11 +643,11 @@ bool env_eval_ident (s_env *env, const s_ident *ident, s_tag *dest)
   assert(ident);
   ident_init_copy(&tmp_ident, ident);
   ident_resolve_module(&tmp_ident, env);
-  if (! ((tag = frame_get(env->frame, tmp_ident.sym)) ||
+  if (! ((tag = env_frames_get(env, tmp_ident.sym)) ||
          (tag = ident_get(&tmp_ident, &env->facts, &tmp)))) {
-    warnx("unbound ident: %s.%s",
-          tmp_ident.module->str.ptr.pchar,
-          tmp_ident.sym->str.ptr.pchar);
+    err_write_1("env_eval_ident: unbound ident: ");
+    err_inspect_ident(ident);
+    err_write_1("\n");
     return false;
   }
   tag_init_copy(dest, tag);
@@ -649,7 +660,7 @@ bool env_eval_ident_is_bound (s_env *env, const s_ident *ident)
   s_tag tmp;
   assert(env);
   assert(ident);
-  if (frame_get(env->frame, ident->sym))
+  if (env_frames_get(env, ident->sym))
     return true;
   ident_init_copy(&tmp_ident, ident);
   ident_resolve_module(&tmp_ident, env);
@@ -1193,6 +1204,15 @@ bool env_eval_void (s_env *env, const void *_, s_tag *dest)
   return true;
 }
 
+const s_tag * env_frames_get (const s_env *env, const s_sym *name)
+{
+  const s_tag *tag;
+  if ((tag = frame_get(env->frame, name)) ||
+      (tag = frame_get(&env->global_frame, name)))
+    return tag;
+  return NULL;
+}
+
 s_env * env_init (s_env *env, int argc, char **argv)
 {
   s_str path;
@@ -1201,7 +1221,8 @@ s_env * env_init (s_env *env, int argc, char **argv)
     return NULL;
   sym_init_g_sym();
   env->error_handler = NULL;
-  env->frame = frame_new(NULL);
+  env->frame = frame_new(NULL);         // toplevel
+  frame_init(&env->global_frame, NULL); // globals
   buf_init_alloc(&env->in, BUF_SIZE);
   buf_file_open_r(&env->in, stdin);
   buf_init_alloc(&env->out, BUF_SIZE);
@@ -1739,7 +1760,7 @@ bool env_tag_ident_is_bound (const s_env *env, const s_tag *tag,
   assert(tag);
   assert(tag->type == TAG_IDENT);
   return tag->type == TAG_IDENT &&
-    (frame_get(env->frame, tag->data.ident.sym) ||
+    (env_frames_get(env, tag->data.ident.sym) ||
      ident_get(&tag->data.ident, facts, &tmp));
 }
 
diff --git a/libc3/env.h b/libc3/env.h
index ee5c789..5af1b69 100644
--- a/libc3/env.h
+++ b/libc3/env.h
@@ -21,6 +21,9 @@ extern s_env g_c3_env;
 void    env_clean (s_env *env);
 s_env * env_init (s_env *env, int argc, char **argv);
 
+/* Observers. */
+const s_tag * env_frames_get (const s_env *env, const s_sym *name);
+
 /* Operators. */
 bool          env_eval_array (s_env *env, const s_array *array,
                               s_array *dest);
@@ -37,17 +40,22 @@ bool          env_eval_call_cfn (s_env *env, const s_call *call,
 bool          env_eval_call_fn (s_env *env, const s_call *call,
                                 s_tag *dest);
 bool          env_eval_call_resolve (s_env *env, s_call *call);
-bool          env_eval_equal_block (s_env *env, const s_block *a,
-                                    const s_block *b, s_block *dest);
-bool          env_eval_equal_list (s_env *env, const s_list *a,
-                                   const s_list *b, s_list **dest);
-bool          env_eval_equal_struct (s_env *env, const s_struct *a,
+bool          env_eval_equal_block (s_env *env, bool macro,
+                                    const s_block *a, const s_block *b,
+                                    s_block *dest);
+bool          env_eval_equal_list (s_env *env, bool macro,
+                                   const s_list *a, const s_list *b,
+                                   s_list **dest);
+bool          env_eval_equal_struct (s_env *env, bool macro,
+                                     const s_struct *a,
                                      const s_struct *b,
                                      s_struct *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);
+bool          env_eval_equal_tag (s_env *env, bool macro,
+                                  const s_tag *a, const s_tag *b,
+                                  s_tag *dest);
+bool          env_eval_equal_tuple (s_env *env, bool macro,
+                                    const s_tuple *a, const s_tuple *b,
+                                    s_tuple *dest);
 bool          env_eval_fn (s_env *env, const s_fn *fn, s_tag *dest);
 bool          env_eval_fn_call (s_env *env, const s_fn *fn,
                                 const s_list *arguments, s_tag *dest);
diff --git a/libc3/frame.c b/libc3/frame.c
index 0a8a944..3e4c3c5 100644
--- a/libc3/frame.c
+++ b/libc3/frame.c
@@ -50,13 +50,7 @@ void frame_delete_all (s_frame *frame)
 
 const s_tag * frame_get (const s_frame *frame, const s_sym *sym)
 {
-  const s_tag *tag;
-  while (frame) {
-    if ((tag = binding_get(frame->bindings, sym)))
-      return tag;
-    frame = frame->next;
-  }
-  return NULL;
+  return binding_get(frame->bindings, sym);
 }
 
 s_frame * frame_init (s_frame *frame, s_frame *next)
diff --git a/libc3/tag.c b/libc3/tag.c
index 931d2fe..878dfb3 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -261,7 +261,7 @@ s_tag * tag_equal (const s_tag *a, const s_tag *b, s_tag *dest)
   assert(a);
   assert(b);
   assert(dest);
-  if (! env_eval_equal_tag (&g_c3_env, a, b, dest))
+  if (! env_eval_equal_tag (&g_c3_env, false, a, b, dest))
     return NULL;
   return dest;
 }
diff --git a/libc3/tag_add.c b/libc3/tag_add.c
index 1ddb007..9bb8639 100644
--- a/libc3/tag_add.c
+++ b/libc3/tag_add.c
@@ -10,9 +10,7 @@
  * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
  * THIS SOFTWARE.
  */
-#include <assert.h>
-#include <err.h>
-#include <math.h>
+#include "assert.h"
 #include "integer.h"
 #include "tag.h"
 
@@ -1218,7 +1216,9 @@ s_tag * tag_add (const s_tag *a, const s_tag *b, s_tag *dest)
     goto ko;
   }
  ko:
-  errx(1, "cannot add %s to %s",
-       tag_type_to_string(a->type),
-       tag_type_to_string(b->type));
+  err_write_1("tag_add: cannot add ");
+  err_write_1(tag_type_to_string(a->type));
+  err_write_1(" to ");
+  err_puts(tag_type_to_string(b->type));
+  return NULL;
 }
diff --git a/libc3/types.h b/libc3/types.h
index 682962e..894f31e 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -598,6 +598,7 @@ struct env {
   s_error_handler  *error_handler;
   s_facts           facts;
   s_frame          *frame;
+  s_frame           global_frame;
   s_buf             in;
   s_str             module_path;
   s_buf             out;
diff --git a/test/env_test.c b/test/env_test.c
index c84b949..43a6dad 100644
--- a/test/env_test.c
+++ b/test/env_test.c
@@ -66,8 +66,10 @@ TEST_CASE(env_eval_equal_tag)
   env_init(&env, 0, NULL);
   env.frame = frame_init(&frame, env.frame);
   test_context("x = 1");
-  TEST_ASSERT(env_eval_equal_tag(&env, tag_init_1(&x, "x"),
-                                 tag_init_1(&y, "1"), &z));
+  TEST_ASSERT(env_eval_equal_tag(&env, false,
+                                 tag_init_1(&x, "x"),
+                                 tag_init_1(&y, "1"),
+                                 &z));
   TEST_ASSERT(frame_get(&frame, x.data.ident.sym));
   TEST_EQ(compare_tag(&z, &y), 0);
   tag_clean(&z);
@@ -76,8 +78,10 @@ TEST_CASE(env_eval_equal_tag)
   env_init(&env, 0, NULL);
   env.frame = frame_init(&frame, env.frame);
   test_context("x = (1, 2]");
-  TEST_ASSERT(env_eval_equal_tag(&env, tag_init_1(&x, "x"),
-                                 tag_init_1(&y, "[1, 2]"), &z));
+  TEST_ASSERT(env_eval_equal_tag(&env, false,
+                                 tag_init_1(&x, "x"),
+                                 tag_init_1(&y, "[1, 2]"),
+                                 &z));
   TEST_ASSERT(frame_get(&frame, sym_1("x")));
   TEST_EQ(compare_tag(&z, &y), 0);
   tag_clean(&z);
@@ -86,8 +90,10 @@ TEST_CASE(env_eval_equal_tag)
   env_init(&env, 0, NULL);
   env.frame = frame_init(&frame, env.frame);
   test_context("[] = []");
-  TEST_ASSERT(env_eval_equal_tag(&env, tag_1(&x, "[]"),
-                                 tag_1(&y, "[]"), &z));
+  TEST_ASSERT(env_eval_equal_tag(&env, false,
+                                 tag_1(&x, "[]"),
+                                 tag_1(&y, "[]"),
+                                 &z));
   TEST_EQ(compare_tag(&z, &y), 0);
   tag_clean(&z);
   env.frame = frame_clean(&frame);
@@ -95,8 +101,10 @@ TEST_CASE(env_eval_equal_tag)
   env_init(&env, 0, NULL);
   env.frame = frame_init(&frame, env.frame);
   test_context("[a, b] = [1, 2]");
-  TEST_ASSERT(env_eval_equal_tag(&env, tag_1(&x, "[a, b]"),
-                                 tag_1(&y, "[1, 2]"), &z));
+  TEST_ASSERT(env_eval_equal_tag(&env, false,
+                                 tag_1(&x, "[a, b]"),
+                                 tag_1(&y, "[1, 2]"),
+                                 &z));
   TEST_ASSERT(frame_get(&frame, sym_1("a")));
   TEST_ASSERT(frame_get(&frame, sym_1("b")));
   TEST_EQ(compare_tag(&z, &y), 0);
@@ -106,8 +114,10 @@ TEST_CASE(env_eval_equal_tag)
   env_init(&env, 0, NULL);
   env.frame = frame_init(&frame, env.frame);
   test_context("x = [1, 2]");
-  TEST_ASSERT(env_eval_equal_tag(&env, tag_1(&x, "[a | b]"),
-                                 tag_1(&y, "[1, 2]"), &z));
+  TEST_ASSERT(env_eval_equal_tag(&env, false,
+                                 tag_1(&x, "[a | b]"),
+                                 tag_1(&y, "[1, 2]"),
+                                 &z));
   TEST_ASSERT(frame_get(&frame, sym_1("a")));
   TEST_ASSERT(frame_get(&frame, sym_1("b")));
   TEST_EQ(compare_tag(&z, &y), 0);