aboutsummaryrefslogtreecommitdiff
path: root/src/boot/ast.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-08-30 12:05:47 +0000
committerdos-reis <gdr@axiomatics.org>2009-08-30 12:05:47 +0000
commitd7aca7e90f3579181f67804f7ac7ba0da4eb44d9 (patch)
tree486137c9a458f69051f730fd70d3199f435b81ac /src/boot/ast.boot
parent9fecfc240728b7953537c2a2c837f7a420c274af (diff)
downloadopen-axiom-d7aca7e90f3579181f67804f7ac7ba0da4eb44d9.tar.gz
* boot/ast.boot (bfSequence): Simplify COND branch bodies.
Diffstat (limited to 'src/boot/ast.boot')
-rw-r--r--src/boot/ast.boot19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot
index 0d8c17a8..13a813e0 100644
--- a/src/boot/ast.boot
+++ b/src/boot/ast.boot
@@ -995,22 +995,27 @@ bfFlattenSeq x ==
rest f
[f]
+++ The body of each branch of a COND form is an implicit PROGN.
+++ For readability purpose, we want to refrain from including
+++ any explicit PROGN.
+bfWashCONDBranchBody x ==
+ x is ["PROGN",:y] => y
+ [x]
+
bfSequence l ==
null l=> NIL
- transform:= [[a,b] for x in l while
+ transform:= [[a,:bfWashCONDBranchBody b] for x in l while
x is ["COND",[a,["IDENTITY",b]]]]
no:=#transform
before:= bfTake(no,l)
aft := bfDrop(no,l)
null before =>
- null rest l =>
- f:=first l
- if EQCAR(f,"PROGN")
- then bfSequence rest f
- else f
+ l is [f] =>
+ f is ["PROGN",:.] => bfSequence rest f
+ f
bfMKPROGN [first l,bfSequence rest l]
null aft => ["COND",:transform]
- ["COND",:transform,['(QUOTE T),bfSequence aft]]
+ ["COND",:transform,['(QUOTE T),:bfWashCONDBranchBody bfSequence aft]]
bfWhere (context,expr)==
[opassoc,defs,nondefs] := defSheepAndGoats context