login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxSTRING2SPAD revision 5 of 7

1 2 3 4 5 6 7
Editor: Bill Page
Time: 2011/03/07 17:08:08 GMT-8
Note: output as string

changed:
-)lisp (defun string2spad (the-string-list) (let* ( ($LISPLIB t) (|$QuickLet| t) (|$QuickCode| t) (|$InteractiveMode| nil) (*standard-input* (make-string-input-stream (format nil "~{~A~^~%~}" the-string-list))) (*standard-output* (make-string-output-stream)) ) (declare (special $LISPLIB |$InteractiveMode|)) (|spadCompile| nil) (get-output-stream-string *standard-output* ) ))
)lisp (defun string2spad (the-string-list) (let* ( ($LISPLIB t) (|$QuickLet| t) (|$QuickCode| t) (|$InteractiveMode| nil) (*standard-input* (make-string-input-stream (format nil "~{~A~^~%~}" the-string-list))) ) (declare (special $LISPLIB |$InteractiveMode|)) (|spadCompile| nil) ))

changed:
-STRING2SPAD("")$Lisp
\end{axiom}
\begin{axiom}

changed:
-After we have actually compiled something once it now works.
After we have actually compiled something once it now works
\begin{axiom}
)lisp (defun string2spad (the-string-list) (let* ( ($LISPLIB t) (|$QuickLet| t) (|$QuickCode| t) (|$InteractiveMode| nil) (*standard-input* (make-string-input-stream (format nil "~{~A~^~%~}" the-string-list))) (*standard-output* (make-string-output-stream)) ) (declare (special $LISPLIB |$InteractiveMode|)) (|spadCompile| nil) (get-output-stream-string *standard-output* ) ))
\end{axiom}
and we can get the result as a string

Waldek Hebisch helped me with writing the following Lisp code to call the SPAD compiler from the FriCAS?/AXIOM interpreter.

axiom
)set output algebra on
 
axiom
)set output tex off

Unfortunately it fails with an obscure error message

axiom
)lisp (defun string2spad (the-string-list) (let* ( ($LISPLIB t) (|$QuickLet| t) (|$QuickCode| t) (|$InteractiveMode| nil) (*standard-input* (make-string-input-stream (format nil "~{~A~^~%~}" the-string-list))) ) (declare (special $LISPLIB |$InteractiveMode|)) (|spadCompile| nil) ))
Value = STRING2SPAD

axiom
S:=[")abbrev domain XXX xxx",
    "xxx():BasicType == Integer"]
(1) [")abbrev domain XXX xxx","xxx():BasicType == Integer"]
Type: List(String)

axiom
STRING2SPAD(S)$Lisp
XXX abbreviates domain xxx
>> System error: The function |recordHeaderDocumentation| is undefined.

unless if we first compile something else using a )comiple file.spad command

spad
)abbrev domain YYY yyy
yyy():BasicType==Integer
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/174773479446238758-25px005.spad using 
      old system compiler.
   YYY abbreviates domain yyy 
------------------------------------------------------------------------
   initializing NRLIB YYY for yyy 
   compiling into NRLIB YYY 
(time taken in buildFunctor:  10)
;;; *** |yyy| REDEFINED
;;; *** |yyy| REDEFINED Time: 0.05 SEC.
Cumulative Statistics for Constructor yyy Time: 0.05 seconds
--------------non extending category---------------------- .. yyy of cat (|BasicType|) has no (|IntegerNumberSystem|) finalizing NRLIB YYY Processing yyy for Browser database: --->-->yyy(): Missing Description ; compiling file "/var/zope2/var/LatexWiki/YYY.NRLIB/YYY.lsp" (written 07 MAR 2011 05:07:58 PM): ; compiling (/VERSIONCHECK 2) ; compiling (DEFUN |yyy| ...) ; compiling (DEFUN |yyy;| ...) ; compiling (MAKEPROP (QUOTE |yyy|) ...) ; compiling (MAKEPROP (QUOTE |yyy|) ...)
; /var/zope2/var/LatexWiki/YYY.NRLIB/YYY.fasl written ; compilation finished in 0:00:00.132 ------------------------------------------------------------------------ yyy is now explicitly exposed in frame initial yyy will be automatically loaded when needed from /var/zope2/var/LatexWiki/YYY.NRLIB/YYY

After we have actually compiled something once it now works

axiom
)lisp (defun string2spad (the-string-list) (let* ( ($LISPLIB t) (|$QuickLet| t) (|$QuickCode| t) (|$InteractiveMode| nil) (*standard-input* (make-string-input-stream (format nil "~{~A~^~%~}" the-string-list))) (*standard-output* (make-string-output-stream)) ) (declare (special $LISPLIB |$InteractiveMode|)) (|spadCompile| nil) (get-output-stream-string *standard-output* ) ))
Value = STRING2SPAD

and we can get the result as a string

axiom
result:=string STRING2SPAD(S)$Lisp
(2) ";)abbrev domain XXX xxx XXX abbreviates domain xxx ;xxx():BasicType == I nteger ---------------------------------------------------------------------- -- initializing NRLIB XXX for xxx compiling into NRLIB XXX (time take n in buildFunctor: 0)
;;; *** |xxx| REDEFINED
;;; *** |xxx| REDEFINED Time: 0.05 SEC.
Cumulative Statistics for Constructor xx x Time: 0.05 seconds
--------------non extending category------------ ---------- .. xxx of cat (|BasicType|) has no (|IntegerNumberSystem|) finalizing NRLIB XXX Processing xxx for Browser database: --->-->xxx(): M issing Description ; compiling file "/var/zope2/var/LatexWiki/XXX.NRLIB/XXX.l sp" (written 07 MAR 2011 05:08:03 PM): ; compiling (DEFUN |xxx| ...) ; compil ing (DEFUN |xxx;| ...) ; compiling (MAKEPROP (QUOTE |xxx|) ...) ; compiling ( MAKEPROP (QUOTE |xxx|) ...)
; /var/zope2/var/LatexWiki/XXX.NRLIB/XXX.fasl wr itten ; compilation finished in 0:00:00.121 --------------------------------- --------------------------------------- xxx is now explicitly exposed in f rame initial xxx will be automatically loaded when needed from /va r/zope2/var/LatexWiki/XXX.NRLIB/XXX
"
Type: String

So presumablly something is being loaded dynamically.