diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 9adaa70..5c2c1db 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -6908,6 +6908,59 @@ of the form ('expression expr position) @ +\defun{pfFlattenApp}{pfFlattenApp} +\calls{pfFlattenApp}{pfApplication?} +\calls{pfFlattenApp}{pfCollect1?} +\calls{pfFlattenApp}{pfFlattenApp} +\calls{pfFlattenApp}{pfApplicationOp} +\calls{pfFlattenApp}{pfApplicationArg} +<>= +(defun |pfFlattenApp| (x) + (cond + ((|pfApplication?| x) + (cond + ((|pfCollect1?| x) (LIST x)) + (t + (append (|pfFlattenApp| (|pfApplicationOp| x)) + (|pfFlattenApp| (|pfApplicationArg| x)))))) + (t (list x)))) + +@ + +\defun{pfCollect1?}{pfCollect1?} +\calls{pfCollect1?}{pfApplication?} +\calls{pfCollect1?}{pfApplicationOp} +\calls{pfCollect1?}{pfId?} +\calls{pfCollect1?}{pfIdSymbol} +<>= +(defun |pfCollect1?| (x) + (let (a) + (when (|pfApplication?| x) + (setq a (|pfApplicationOp| x)) + (when (|pfId?| a) (eq (|pfIdSymbol| a) '|\||))))) + +@ + +\defun{pfCollectVariable1}{pfCollectVariable1} +\calls{pfCollectVariable1}{pfApplicationArg} +\calls{pfCollectVariable1}{pf0TupleParts} +\calls{pfCollectVariable1}{pfTaggedToTyped} +\calls{pfCollectVariable1}{pfTyped} +\calls{pfCollectVariable1}{pfSuch} +\calls{pfCollectVariable1}{pfTypedId} +\calls{pfCollectVariable1}{pfTypedType} +<>= +(defun |pfCollectVariable1| (x) + (let (id var a) + (setq a (|pfApplicationArg| x)) + (setq var (car (|pf0TupleParts| a))) + (setq id (|pfTaggedToTyped| var)) + (|pfTyped| + (|pfSuch| (|pfTypedId| id) (cadr (|pf0TupleParts| a))) + (|pfTypedType| id)))) + +@ + \defun{pfSourceStok}{pfSourceStok} \calls{pfSourceStok}{pfLeaf?} \calls{pfSourceStok}{pfParts} @@ -7591,7 +7644,7 @@ of the form ('expression expr position) \calls{pfFromDom}{pfApplication} \calls{pfFromDom}{pfApplicationOp} \calls{pfFromDom}{pfApplicationArg} -\calls{pfFromDom}{pfFromDom} +\calls{pfFromDom}{pfFromdom} <>= (defun |pfFromDom| (dom expr) (cond @@ -7603,6 +7656,14 @@ of the form ('expression expr position) @ +\defun{pfFromdom}{Construct a Fromdom node} +\calls{pfFromdom}{pfTree} +<>= +(defun |pfFromdom| (pfwhat pfdomain) + (|pfTree| '|Fromdom| (list pfwhat pfdomain))) + +@ + \defun{pfFromdom?}{Is this a Fromdom mode?} \calls{pfFromdom?}{pfAbSynOp?} <>= @@ -8123,6 +8184,14 @@ of the form ('expression expr position) @ +\defun{pfTyped}{Construct a Typed node} +\calls{pfTyped}{pfTree} +<>= +(defun |pfTyped| (pfid pftype) + (|pfTree| '|Typed| (list pfid pftype))) + +@ + \defun{pfTyped?}{Is this a Typed node?} \calls{pfTyped?}{pfAbSynOp?} <>= @@ -8245,6 +8314,14 @@ of the form ('expression expr position) @ +\defun{pfWith}{Construct a With node} +\calls{pfWith}{pfTree} +<>= +(defun |pfWith| (pfbase pfwithin pfwithon) + (|pfTree| '|With| (list pfbase pfwithin pfwithon))) + +@ + \defun{pfWrong}{Create a Wrong node} \calls{pfWrong}{pfTree} <>= @@ -37116,9 +37193,11 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> +<> <> <> <> @@ -37134,12 +37213,14 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> <> <> +<> <> <> <> @@ -37241,6 +37322,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -37252,6 +37334,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> diff --git a/changelog b/changelog index e6618df..a82b092 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20100219 tpd src/axiom-website/patches.html 20100219.01.tpd.patch +20100219 tpd src/interp/ptrees.lisp treeshake +20100219 tpd books/bookvol5 treeshake ptrees 20100218 tpd src/axiom-website/patches.html 20100218.03.tpd.patch 20100218 tpd src/interp/ptrees.lisp treeshake 20100218 tpd src/interp/cparse.lisp treeshake diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index a00f472..8bcb0f4 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2473,5 +2473,7 @@ src/input/pmint.input update pmint with code
books/bookvol5 treeshake cparse, ptrees, remove serror
20100218.03.tpd.patch books/bookvol5 treeshake cparse, ptrees
+20100219.01.tpd.patch +books/bookvol5 treeshake ptrees
diff --git a/src/interp/ptrees.lisp.pamphlet b/src/interp/ptrees.lisp.pamphlet index 7f1f7ab..d54a10d 100644 --- a/src/interp/ptrees.lisp.pamphlet +++ b/src/interp/ptrees.lisp.pamphlet @@ -121,15 +121,6 @@ ; pfWhere? pf or _ ; pfWith? pf -;-- With := (Base: [Typed], Within: [WithPart]) - -;pfWith(pfbase, pfwithin,pfwithon) == -; pfTree('With, [pfbase, pfwithin,pfwithon]) - -(DEFUN |pfWith| (|pfbase| |pfwithin| |pfwithon|) - (PROG () - (RETURN (|pfTree| '|With| (LIST |pfbase| |pfwithin| |pfwithon|))))) - ;-- WDeclare := (Signature: Typed, Doc: ? Document) ;pfWDeclare(pfsignature, pfdoc) == pfTree('WDeclare, [pfsignature, pfdoc]) @@ -138,18 +129,6 @@ (PROG () (RETURN (|pfTree| '|WDeclare| (LIST |pfsignature| |pfdoc|))))) -;-- Typed := (Id: Id, Type: ? Type) - -;pfTyped(pfid, pftype) == pfTree('Typed, [pfid, pftype]) - -(DEFUN |pfTyped| (|pfid| |pftype|) - (PROG () (RETURN (|pfTree| '|Typed| (LIST |pfid| |pftype|))))) - -;-- Application := (Op: Expr, Arg: Expr) - -;pfApplication(pfop, pfarg) == -; pfTree('Application, [pfop, pfarg]) - ;-- Tagged := (Tag: Expr, Expr: Expr) ;pfTagged(pftag, pfexpr) == pfTree('Tagged, [pftag, pfexpr]) @@ -184,13 +163,6 @@ (DEFUN |pfCoerceto| (|pfexpr| |pftype|) (PROG () (RETURN (|pfTree| '|Coerceto| (LIST |pfexpr| |pftype|))))) -;-- Fromdom := (What: Id, Domain: Type) - -;pfFromdom(pfwhat, pfdomain) == pfTree('Fromdom, [pfwhat, pfdomain]) - -(DEFUN |pfFromdom| (|pfwhat| |pfdomain|) - (PROG () (RETURN (|pfTree| '|Fromdom| (LIST |pfwhat| |pfdomain|))))) - ;pfFix pf== pfApplication(pfId "Y",pf) (DEFUN |pfFix| (|pf|) @@ -223,11 +195,6 @@ (DEFUN |pfWhere| (|pfcontext| |pfexpr|) (PROG () (RETURN (|pfTree| '|Where| (LIST |pfcontext| |pfexpr|))))) -;-- If := (Cond: Expr, Then: Expr, Else: ? Expr) -; -;pfIf(pfcond, pfthen, pfelse) == pfTree('If, [pfcond, pfthen, pfelse]) - - ;-- Loop := (Iterators: [Iterator]) ;pfLoop(pfiterators) == pfTree('Loop, [pfiterators]) @@ -257,13 +224,6 @@ (DEFUN |pfWhile| (|pfcond|) (PROG () (RETURN (|pfTree| '|While| (LIST |pfcond|))))) -;-- Until := (Cond: Expr) - -;--pfUntil(pfcond) == pfTree('Until, [pfcond]) -;--pfUntil?(pf) == pfAbSynOp? (pf, 'Until) -;--pfUntilCond pf == CADR pf -- was ==> - - ;-- Suchthat := (Cond: Expr) ;pfSuchthat(pfcond) == pfTree('Suchthat, [pfcond]) @@ -377,43 +337,6 @@ (DEFUN |pfQualType| (|pftype| |pfqual|) (PROG () (RETURN (|pfTree| '|QualType| (LIST |pftype| |pfqual|))))) -;pfCollectVariable1 x== -; a := pfApplicationArg x -; var:=first pf0TupleParts a -; id:=pfTaggedToTyped var -; pfTyped(pfSuch(pfTypedId id,CADR pf0TupleParts a), -; pfTypedType id) - -(DEFUN |pfCollectVariable1| (|x|) - (PROG (|id| |var| |a|) - (RETURN - (PROGN - (SETQ |a| (|pfApplicationArg| |x|)) - (SETQ |var| (CAR (|pf0TupleParts| |a|))) - (SETQ |id| (|pfTaggedToTyped| |var|)) - (|pfTyped| - (|pfSuch| (|pfTypedId| |id|) (CADR (|pf0TupleParts| |a|))) - (|pfTypedType| |id|)))))) - -;pfCollect1? x== -; pfApplication? x => -; a:=pfApplicationOp x -; pfId? a => pfIdSymbol a = "|" -; false -; false - -(DEFUN |pfCollect1?| (|x|) - (PROG (|a|) - (RETURN - (COND - ((|pfApplication?| |x|) - (PROGN - (SETQ |a| (|pfApplicationOp| |x|)) - (COND - ((|pfId?| |a|) (EQ (|pfIdSymbol| |a|) '|\||)) - ('T NIL)))) - ('T NIL))))) - ;pfCheckMacroOut form == ; pfId? form => [form,nil] ; pfApplication? form => @@ -494,25 +417,6 @@ (|pfMLambda| (CAR |args|) (|pfPushMacroBody| (CDR |args|) |body|))))))) -;pfFlattenApp x== -; pfApplication? x=> -; pfCollect1? x =>[ x ] -; append (pfFlattenApp pfApplicationOp x, -; pfFlattenApp pfApplicationArg x) -; [x] - -(DEFUN |pfFlattenApp| (|x|) - (PROG () - (RETURN - (COND - ((|pfApplication?| |x|) - (COND - ((|pfCollect1?| |x|) (LIST |x|)) - ('T - (APPEND (|pfFlattenApp| (|pfApplicationOp| |x|)) - (|pfFlattenApp| (|pfApplicationArg| |x|)))))) - ('T (LIST |x|)))))) - @ \eject \begin{thebibliography}{99}