From 292bd212f1c30a51f0191128d5a9cd2691c5ccf9 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Wed, 28 Dec 2011 06:12:21 +0000 Subject: * boot/tokens.boot: Remove redundant renaming of REM. loopBody and loopExit are not selectors. * interp/i-output.boot: Include sys-utility. * interp/sys-utility.boot (last): New macro. (loopBody): Likewise. * interp/vmlisp.lisp (LASTNODE): Remove. (LASTPAIR): Likewise. (last): Do not define here. --- src/interp/Makefile.in | 2 +- src/interp/g-opt.boot | 2 ++ src/interp/i-output.boot | 1 + src/interp/slam.boot | 2 +- src/interp/sys-utility.boot | 8 ++++++++ src/interp/vmlisp.lisp | 10 ---------- 6 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src/interp') diff --git a/src/interp/Makefile.in b/src/interp/Makefile.in index 2157553b..5930d44f 100644 --- a/src/interp/Makefile.in +++ b/src/interp/Makefile.in @@ -279,7 +279,7 @@ osyscmd.$(FASLEXT): int-top.$(FASLEXT) int-top.$(FASLEXT): incl.$(FASLEXT) i-toplev.$(FASLEXT) unlisp.$(FASLEXT) i-toplev.$(FASLEXT): i-analy.$(FASLEXT) i-syscmd.$(FASLEXT): i-object.$(FASLEXT) -i-output.$(FASLEXT): sys-macros.$(FASLEXT) +i-output.$(FASLEXT): sys-utility.$(FASLEXT) sys-macros.$(FASLEXT) i-special.$(FASLEXT): i-analy.$(FASLEXT) i-funsel.$(FASLEXT): i-coerfn.$(FASLEXT) i-map.$(FASLEXT): i-object.$(FASLEXT) diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 880d088b..ef5b6a51 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -317,6 +317,8 @@ unnestWhen! x == f x where x is ['%seq,:.] => for stmts in tails x.args repeat stmts.first := f first stmts + x is ['%repeat,:.] => + x.loopBody := unnestWhen! x.loopBody x ++ Transform nested-to-tower. diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot index 20028fc4..421e9386 100644 --- a/src/interp/i-output.boot +++ b/src/interp/i-output.boot @@ -32,6 +32,7 @@ -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import sys_-utility import sys_-macros namespace BOOT diff --git a/src/interp/slam.boot b/src/interp/slam.boot index 11816e99..13768228 100644 --- a/src/interp/slam.boot +++ b/src/interp/slam.boot @@ -298,7 +298,7 @@ compileRecurrenceRelation(op,nam,argl,junk,[body,sharpArg,n,:initCode]) == newValueCode:= ["%LET",g,substitute(gIndex,sharpArg, applySubst(pairList(rest $TriangleVariableList,gsList),body))] ['%bind,decomposeBindings, - ['%repeat,["WHILE",true],["PROGN",endTest,advanceCode, + ['%repeat,["WHILE",'%true],["PROGN",endTest,advanceCode, newValueCode,:rotateCode],voidValue()]] fromScratchInit:= [["%LET",gIndex,n],:[["%LET",g,x] for g in gsList for x in initCode]] diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot index f9f7cbf8..96bd829b 100644 --- a/src/interp/sys-utility.boot +++ b/src/interp/sys-utility.boot @@ -405,6 +405,14 @@ displayTextFile f == finally stream ~= nil => closeStream stream +--% +macro last x == + lastNode(x).first + +--% +macro loopBody x == + take(-2,x).first + --% macro constructorDB ctor == property(ctor,'DATABASE) diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp index e922e1de..e571a161 100644 --- a/src/interp/vmlisp.lisp +++ b/src/interp/vmlisp.lisp @@ -174,12 +174,6 @@ (defmacro lam (&rest body) (list 'quote (*lam (copy-tree body)))) -(defmacro lastnode (l) - `(last ,l)) - -(defmacro lastpair (l) - `(last ,l)) - (defmacro lessp (&rest args) `(< ,@args)) @@ -665,10 +659,6 @@ ((and (atom item) (not (arrayp item))) (member item sequence)) (T (member item sequence :test #'equalp)))) -; 14.2 Accessing - -(defun |last| (x) (car (lastpair x))) - ; 14.3 Searching (DEFUN |assoc| (X Y) -- cgit v1.2.3