diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-10-03 09:43:30 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-10-03 09:43:30 -0700 |
commit | 53b4090be0ed161aadf9a7c36ebc896f3e131a1f (patch) | |
tree | 30e7554d93d4f0a45a64ab813092b30565791ecd /lib.c | |
parent | d1a8b58b39e131df4a9fdc748cda449c0447bd19 (diff) | |
download | txr-53b4090be0ed161aadf9a7c36ebc896f3e131a1f.tar.gz txr-53b4090be0ed161aadf9a7c36ebc896f3e131a1f.tar.bz2 txr-53b4090be0ed161aadf9a7c36ebc896f3e131a1f.zip |
Implemented new last clause for collect and coll.
Bugfix in cases inside coll: was not collecting bindings.
Bugfix for until inside coll: was not seeing bindings
from main clause.
* lib.c (ldiff): New function.
* lib.h (ldiff): Declared.
* match.c (match_line): Implemented last clause. Fixed cases
handling by moving misplaced termination check.
(match_files): Implemented last clause.
* parser.y (until_last): New nonterminal symbol.
(collect_clause): Refactored syntax to support until and last.
(elem): Likewise.
* txr.1: Updated.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -354,6 +354,18 @@ val nappend2(val list1, val list2) return list1; } +val ldiff(val list1, val list2) +{ + list_collect_decl (out, tail); + + while (list1 && list1 != list2) { + list_collect (tail, car(list1)); + list1 = cdr(list1); + } + + return out; +} + static val flatten_helper(val env, val item) { return flatten(item); |