summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-10-04 15:41:33 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-10-04 15:41:33 -0700
commit6dba0b4836e192906c63773527861ddf9de1d679 (patch)
treed1ffc53e6290394a4903e5ec7822c077970dd304 /lib.h
parentb5d5dcb8dcde90bb1766eb88a36e962f8e43fd33 (diff)
downloadtxr-6dba0b4836e192906c63773527861ddf9de1d679.tar.gz
txr-6dba0b4836e192906c63773527861ddf9de1d679.tar.bz2
txr-6dba0b4836e192906c63773527861ddf9de1d679.zip
* lib.c (acons): New function.
(set_diff): Optimize common case: list1 and list2 are the same, or list2 is substructure of list1. Situations in which this won't be the case for variable bindings are rare. * lib.h (acons): Declared. * match.c (match_line): Use acons rather than acons_new, when binding variables that we know are new (the symbol is unbound). When computing the set difference over bindings, use cons cell equality, rather than symbol equality. Symbol equality is wrong because a binding can be removed, and then a new binding can be introduced using the same symbol. This must be treated as a different binding.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib.h b/lib.h
index 6dd743f9..d1323f23 100644
--- a/lib.h
+++ b/lib.h
@@ -376,6 +376,7 @@ val cobj(mem_t *handle, val cls_sym, struct cobj_ops *ops);
val cobjp(val obj);
mem_t *cobj_handle(val cobj, val cls_sym);
val assoc(val list, val key);
+val acons(val list, val car, val cdr);
val acons_new(val list, val key, val value);
val *acons_new_l(val *list, val key, val *new_p);
val alist_remove(val list, val keys);