create Maxima list from multiple return values of a Lisp function
Subject: create Maxima list from multiple return values of a Lisp function
From: Edwin Woollett
Date: Thu, 16 Jun 2011 16:30:47 -0700
On June 16, 2011, Stavros Macrakis wrote
----------------
> If you are in the Lisp mode Read-Evaluate-Print Loop, you must use Lisp
> syntax:
> ($rname "foo.txt","bar.txt")
> If you are in the Maxima mode REPL, you can use Maxima syntax:
> rname("foo.txt","bar.txt")
> You switched to Lisp mode using
> to_lisp();
> To switch back to Maxima mode, type (to-maxima) in Lisp mode.
--------------------------
Thanks, I was really compounding errors.
I think I get it right here:
------------------------
(%i1) :lisp (probe-file "foo.txt")
#pC:/work2/foo.txt
(%i1) to_lisp();
Type (to-maxima) to restart, ($quit) to quit Maxima.
MAXIMA> (defun $rname (mfrom mto)
(cons '(mlist simp) (multiple-value-list (rename-file mfrom mto))))
$RNAME
MAXIMA> (to-maxima)
Returning to Maxima
(%o1) true
(%i2) rname ("foo.txt","bar.txt");
(%o2) [#pbar.txt, #pC:/work2/foo.txt, #pC:/work2/bar.txt]
(%i3) :lisp (probe-file "bar.txt")
#pC:/work2/bar.txt
(%i3) to_lisp();
Type (to-maxima) to restart, ($quit) to quit Maxima.
MAXIMA> ($rname "bar.txt" "foo.txt")
((MLIST SIMP) #p"foo.txt" #p"C:/work2/bar.txt" #p"C:/work2/foo.txt")
----------------------------------------
Ted