aboutsummaryrefslogtreecommitdiff
path: root/src/boot/ast.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-09-25 03:15:11 +0000
committerdos-reis <gdr@axiomatics.org>2009-09-25 03:15:11 +0000
commit7704713134cb251be6129f38833930228e09eee2 (patch)
tree9a6e84cf718748ea7c1d7b47fd4f42c2635654e1 /src/boot/ast.boot
parentd351d1076c6a506fc4bbbb01d26e86c187096ef8 (diff)
downloadopen-axiom-7704713134cb251be6129f38833930228e09eee2.tar.gz
* boot/ast.boot (bfMember): New.
(bfInfApplication): Use it. * boot/tokens.boot: Don't rename IN. * interp/ax.boot (makeAxFile): Fix thinko. (makeAxExportForm): Likewise.
Diffstat (limited to 'src/boot/ast.boot')
-rw-r--r--src/boot/ast.boot13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot
index 0e7b50a8..195ec126 100644
--- a/src/boot/ast.boot
+++ b/src/boot/ast.boot
@@ -680,7 +680,17 @@ bfApplication(bfop, bfarg) ==
bfReName x==
a := x has SHOERENAME => first a
x
-
+
+
+++ Generate code for a membership test `x in seq' where `seq'
+++ is a sequence (e.g. a list)
+bfMember(var,seq) ==
+ seq is ["QUOTE",seq'] and "and"/[SYMBOLP x for x in seq'] =>
+ ["MEMQ",var,seq]
+ var is ["QUOTE",var'] and SYMBOLP var' =>
+ ["MEMQ",var,seq]
+ ["MEMBER",var,seq]
+
bfInfApplication(op,left,right)==
op = "EQUAL" => bfQ(left,right)
op = "/=" => bfNOT bfQ(left,right)
@@ -690,6 +700,7 @@ bfInfApplication(op,left,right)==
op = ">=" => bfNOT bfLessp(left,right)
op = "OR" => bfOR [left,right]
op = "AND" => bfAND [left,right]
+ op = "IN" => bfMember(left,right)
[op,left,right]
bfNOT x==