diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index b5885a9..ebc9eee 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -53021,6 +53021,117 @@ There are 8 parts of an htPage: \end{chunk} +\defun{mkConArgSublis}{mkConArgSublis} +\calls{mkConArgSublis}{pname} +\calls{mkConArgSublis}{maxindex} +\calls{mkConArgSublis}{digitp} +\calls{mkConArgSublis}{digits2Names} +\begin{chunk}{defun mkConArgSublis} +(defun |mkConArgSublis| (args) + (loop for arg in args + when + (and + (setq s (pname arg)) + (some #'identity + (loop for i from 0 to (maxindex s) + collect (digitp (elt s i))))) + collect (cons arg (intern (|digits2Names| (pname arg)))))) + +\end{chunk} + +This is necessary since arguments of conforms CANNOT have +digits in TechExplorer. Since Saturn is gone we can remove it. + +\defun{digits2Names}{digits2Names} +\calls{digits2Names}{digit-char-p} +\calls{digits2Names}{concat} +\begin{chunk}{defun digits2Names} +(defun |digits2Names| (s) + (let (str c n segment) + (setq str "") + (for i from 0 to (maxindex s) do + (setq c (elt s i)) + (setq segment + (cond + ((setq n (digit-char-p c)) + (elt + '("Zero" "One" "Two" "Three" "Four" "Five" "Six" "Seven" "Eight" "Nine") + n)) + (t c))) + (concat str segment)) + str)) + +\end{chunk} + +\defun{lefts}{lefts} +\calls{lefts}{hkeys} +\uses{lefts}{hascategory-hash} +\begin{chunk}{defun lefts} +(defun |lefts| (u) + (let (keys) + (setq keys (hkeys *hascategory-hash*)) + (loop for x in keys when (equal (cdr x) u) collect x))) + +\end{chunk} + +\subsection{Build Library Database (libdb.text,...)} + +\defun{dbMkForm}{dbMkForm} +\begin{chunk}{defun dbMkForm} +(defun |dbMkForm| (x) + (or (and (atom x) (cons x nil)) x)) + +\end{chunk} + +\defun{libConstructorSig}{libConstructorSig} +\calls{libConstructorSig}{getdatabase} +\calls{libConstructorSig}{take} +\calls{libConstructorSig}{length} +\calls{libConstructorSig}{sublislis} +\calls{libConstructorSig}{form2LispString} +\calls{libConstructorSig}{ncParseFromString} +\calls{libConstructorSig}{sayBrightly} +\usesdollar{libConstructorSig}{TriangleVariableList} +\begin{chunk}{defun libConstructorSig} +(defun |libConstructorSig| (arg) + (labels ( + (fn (x) + (cond + ((atom x) x) + ((and (consp x) (eq (qcar x) '|Join|) (consp (qcdr x))) + (list '|Join| (fn (qcadr x)) '|etc|)) + ((and (consp x) (eq (qcar x) 'category)) + '|etc|) + (t + (loop for y in x collect (fn y))))) + (g (x u i) + "does x appear in any but i-th element of u?" + (some #'identity + (loop for y in u for j from 1 + when (not (= i j)) + collect (contained x y))))) + (let (conname argl formals keys sig sigpart) + (declare (special |$TriangleVariableList|)) + (setq conname (car arg)) + (setq argl (cdr arg)) + (setq sig (cdar (getdatabase conname 'constructormodemap))) + (setq formals (take (|#| argl) |$FormalMapVariableList|)) + (setq sig (sublislis formals |$TriangleVariableList| sig)) + (setq keys + (loop for f in formals for i from 1 + collect (g f sig i))) + (setq sig + (fn (sublislis argl |$FormalMapVariableList| sig))) + (setq sig (cons (car sig) + (loop for a in argl for s in (cdr sig) for k in keys + collect (if k (list #\: a s) s)))) + (setq sigpart (|form2LispString| (cons '|Mapping| sig))) + (unless (|ncParseFromString| sigpart) + (|sayBrightly| (list "Won't parse: " sigpart))) + sigpart))) + +\end{chunk} + \chapter{The Interpreter} \begin{chunk}{Interpreter} (setq *print-array* nil) @@ -53635,6 +53746,7 @@ There are 8 parts of an htPage: \getchunk{defun dbGetDocTable} \getchunk{defun dbGetDocTable,gn} \getchunk{defun dbGetDocTable,hn} +\getchunk{defun dbMkForm} \getchunk{defun dbNonEmptyPattern} \getchunk{defun dbSearchOrder} \getchunk{defun dbSelectCon} @@ -53678,6 +53790,7 @@ There are 8 parts of an htPage: \getchunk{defun diffAlist} \getchunk{defun digit?} \getchunk{defun digitp} +\getchunk{defun digits2Names} \getchunk{defun disableHist} \getchunk{defun display} \getchunk{defun displayCondition} @@ -54056,10 +54169,12 @@ There are 8 parts of an htPage: \getchunk{defun lastTokPosn} \getchunk{defun leader?} \getchunk{defun leaveScratchpad} +\getchunk{defun lefts} \getchunk{defun letPrint} \getchunk{defun letPrint2} \getchunk{defun letPrint3} \getchunk{defun lfkey} +\getchunk{defun libConstructorSig} \getchunk{defun library} \getchunk{defun line?} \getchunk{defun linearFinalRequest} @@ -54118,6 +54233,7 @@ There are 8 parts of an htPage: \getchunk{defun messageprint} \getchunk{defun messageprint-1} \getchunk{defun messageprint-2} +\getchunk{defun mkConArgSublis} \getchunk{defun mkConform} \getchunk{defun mkCurryFun} \getchunk{defun mkDomPvar} diff --git a/changelog b/changelog index f555171..b312204 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20130625 tpd src/axiom-website/patches.html 20130625.02.tpd.patch +20130625 tpd src/interp/br-con.lisp move code to bookvol5 +20130625 tpd books/bookvol5 move code from br-con.lisp 20130625 tpd src/axiom-website/patches.html 20130625.01.tpd.patch 20130625 tpd src/sman/Makefile cleanup 20130625 tpd src/share/Makefile cleanup diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 4c5990f..dd04a8d 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -4220,6 +4220,8 @@ books/bookvol5 move code from br-con.lisp books/bookvol5 move code from br-con.lisp 20130625.01.tpd.patch Makefiles cleanup +20130625.02.tpd.patch +books/bookvol5 move code from br-con.lisp diff --git a/src/interp/br-con.lisp.pamphlet b/src/interp/br-con.lisp.pamphlet index 0fb42b8..399bfb2 100644 --- a/src/interp/br-con.lisp.pamphlet +++ b/src/interp/br-con.lisp.pamphlet @@ -12,250 +12,6 @@ \begin{chunk}{*} (IN-PACKAGE "BOOT" ) -;mkConArgSublis args == -; [[arg,:INTERN digits2Names PNAME arg] for arg in args -; | (s := PNAME arg) and or/[DIGITP ELT(s,i) for i in 0..MAXINDEX s]] - -(DEFUN |mkConArgSublis| (|args|) - (PROG (|s|) - (RETURN - (SEQ (PROG (G167986) - (SPADLET G167986 NIL) - (RETURN - (DO ((G167992 |args| (CDR G167992)) (|arg| NIL)) - ((OR (ATOM G167992) - (PROGN (SETQ |arg| (CAR G167992)) NIL)) - (NREVERSE0 G167986)) - (SEQ (EXIT (COND - ((AND (SPADLET |s| (PNAME |arg|)) - (PROG (G167998) - (SPADLET G167998 NIL) - (RETURN - (DO - ((G168004 NIL G167998) - (G168005 (MAXINDEX |s|)) - (|i| 0 (QSADD1 |i|))) - ((OR G168004 - (QSGREATERP |i| G168005)) - G167998) - (SEQ - (EXIT - (SETQ G167998 - (OR G167998 - (DIGITP (ELT |s| |i|)))))))))) - (SETQ G167986 - (CONS - (CONS |arg| - (INTERN - (|digits2Names| (PNAME |arg|)))) - G167986))))))))))))) - -;digits2Names s == -;--This is necessary since arguments of conforms CANNOT have digits in TechExplorer -; str := '"" -; for i in 0..MAXINDEX s repeat -; c := s.i -; segment := -; n := DIGIT_-CHAR_-P c => -; ('("Zero" "One" "Two" "Three" "Four" "Five" "Six" "Seven" "Eight" "Nine")).n -; c -; CONCAT(str, segment) -; str - -(DEFUN |digits2Names| (|s|) - (PROG (|str| |c| |n| |segment|) - (RETURN - (SEQ (PROGN - (SPADLET |str| "") - (DO ((G168025 (MAXINDEX |s|)) (|i| 0 (QSADD1 |i|))) - ((QSGREATERP |i| G168025) NIL) - (SEQ (EXIT (PROGN - (SPADLET |c| (ELT |s| |i|)) - (SPADLET |segment| - (COND - ((SPADLET |n| - (DIGIT-CHAR-P |c|)) - (ELT - '("Zero" "One" "Two" "Three" - "Four" "Five" "Six" "Seven" - "Eight" "Nine") - |n|)) - ('T |c|))) - (CONCAT |str| |segment|))))) - |str|))))) - -;lefts u == -; [x for x in HKEYS _*HASCATEGORY_-HASH_* | CDR x = u] - -(DEFUN |lefts| (|u|) - (PROG () - (declare (special *HASCATEGORY-HASH*)) - (RETURN - (SEQ (PROG (G168041) - (SPADLET G168041 NIL) - (RETURN - (DO ((G168047 (HKEYS *HASCATEGORY-HASH*) - (CDR G168047)) - (|x| NIL)) - ((OR (ATOM G168047) - (PROGN (SETQ |x| (CAR G168047)) NIL)) - (NREVERSE0 G168041)) - (SEQ (EXIT (COND - ((BOOT-EQUAL (CDR |x|) |u|) - (SETQ G168041 (CONS |x| G168041))))))))))))) - -;--====================> WAS b-data.boot <================================ -;--============================================================================ -;-- Build Library Database (libdb.text,...) -;--============================================================================ -;dbMkForm x == atom x and [x] or x - -(DEFUN |dbMkForm| (|x|) (OR (AND (ATOM |x|) (CONS |x| NIL)) |x|)) - -;libConstructorSig [conname,:argl] == -; [[.,:sig],:.] := GETDATABASE(conname,'CONSTRUCTORMODEMAP) -; formals := TAKE(#argl,$FormalMapVariableList) -; sig := SUBLISLIS(formals,$TriangleVariableList,sig) -; keys := [g(f,sig,i) for f in formals for i in 1..] where -; g(x,u,i) == --does x appear in any but i-th element of u? -; or/[CONTAINED(x,y) for y in u for j in 1.. | j ^= i] -; sig := fn SUBLISLIS(argl,$FormalMapVariableList,sig) where -; fn x == -; atom x => x -; x is ['Join,a,:r] => ['Join,fn a,'etc] -; x is ['CATEGORY,:.] => 'etc -; [fn y for y in x] -; sig := [first sig,:[(k => [":",a,s]; s) -; for a in argl for s in rest sig for k in keys]] -; sigpart:= form2LispString ['Mapping,:sig] -; if null ncParseFromString sigpart then -; sayBrightly ['"Won't parse: ",sigpart] -; sigpart - -(DEFUN |libConstructorSig,g| (|x| |u| |i|) - (PROG () - (RETURN - (SEQ (PROG (G168226) - (SPADLET G168226 NIL) - (RETURN - (DO ((G168234 NIL G168226) - (G168235 |u| (CDR G168235)) (|y| NIL) - (|j| 1 (QSADD1 |j|))) - ((OR G168234 (ATOM G168235) - (PROGN (SETQ |y| (CAR G168235)) NIL)) - G168226) - (SEQ (EXIT (COND - ((NEQUAL |j| |i|) - (SETQ G168226 - (OR G168226 (CONTAINED |x| |y|)))))))))))))) - -(DEFUN |libConstructorSig,fn| (|x|) - (PROG (|ISTMP#1| |a| |r|) - (RETURN - (SEQ (IF (ATOM |x|) (EXIT |x|)) - (IF (AND (CONSP |x|) (EQ (QCAR |x|) '|Join|) - (PROGN - (SPADLET |ISTMP#1| (QCDR |x|)) - (AND (CONSP |ISTMP#1|) - (PROGN - (SPADLET |a| (QCAR |ISTMP#1|)) - (SPADLET |r| (QCDR |ISTMP#1|)) - 'T)))) - (EXIT (CONS '|Join| - (CONS (|libConstructorSig,fn| |a|) - (CONS '|etc| NIL))))) - (IF (AND (CONSP |x|) (EQ (QCAR |x|) 'CATEGORY)) - (EXIT '|etc|)) - (EXIT (PROG (G168260) - (SPADLET G168260 NIL) - (RETURN - (DO ((G168265 |x| (CDR G168265)) (|y| NIL)) - ((OR (ATOM G168265) - (PROGN (SETQ |y| (CAR G168265)) NIL)) - (NREVERSE0 G168260)) - (SEQ (EXIT (SETQ G168260 - (CONS - (|libConstructorSig,fn| |y|) - G168260)))))))))))) - -(DEFUN |libConstructorSig| (G168281) - (PROG (|conname| |argl| |LETTMP#1| |formals| |keys| |sig| |sigpart|) - (declare (special |$TriangleVariableList|)) - (RETURN - (SEQ (PROGN - (SPADLET |conname| (CAR G168281)) - (SPADLET |argl| (CDR G168281)) - (SPADLET |LETTMP#1| - (GETDATABASE |conname| 'CONSTRUCTORMODEMAP)) - (SPADLET |sig| (CDAR |LETTMP#1|)) - (SPADLET |formals| - (TAKE (|#| |argl|) |$FormalMapVariableList|)) - (SPADLET |sig| - (SUBLISLIS |formals| |$TriangleVariableList| - |sig|)) - (SPADLET |keys| - (PROG (G168298) - (SPADLET G168298 NIL) - (RETURN - (DO ((G168304 |formals| (CDR G168304)) - (|f| NIL) (|i| 1 (QSADD1 |i|))) - ((OR (ATOM G168304) - (PROGN - (SETQ |f| (CAR G168304)) - NIL)) - (NREVERSE0 G168298)) - (SEQ (EXIT (SETQ G168298 - (CONS - (|libConstructorSig,g| |f| - |sig| |i|) - G168298)))))))) - (SPADLET |sig| - (|libConstructorSig,fn| - (SUBLISLIS |argl| |$FormalMapVariableList| - |sig|))) - (SPADLET |sig| - (CONS (CAR |sig|) - (PROG (G168316) - (SPADLET G168316 NIL) - (RETURN - (DO ((G168323 |argl| (CDR G168323)) - (|a| NIL) - (G168324 (CDR |sig|) - (CDR G168324)) - (|s| NIL) - (G168325 |keys| (CDR G168325)) - (|k| NIL)) - ((OR (ATOM G168323) - (PROGN - (SETQ |a| (CAR G168323)) - NIL) - (ATOM G168324) - (PROGN - (SETQ |s| (CAR G168324)) - NIL) - (ATOM G168325) - (PROGN - (SETQ |k| (CAR G168325)) - NIL)) - (NREVERSE0 G168316)) - (SEQ (EXIT - (SETQ G168316 - (CONS - (COND - (|k| - (CONS '|:| - (CONS |a| (CONS |s| NIL)))) - ('T |s|)) - G168316))))))))) - (SPADLET |sigpart| - (|form2LispString| (CONS '|Mapping| |sig|))) - (COND - ((NULL (|ncParseFromString| |sigpart|)) - (|sayBrightly| - (CONS "Won't parse: " - (CONS |sigpart| NIL))))) - |sigpart|))))) - ;concatWithBlanks r == ; r is [head,:tail] => ; tail => STRCONC(head,'" ",concatWithBlanks tail)