create Maxima list from multiple return values of a Lisp function
Subject: create Maxima list from multiple return values of a Lisp function
From: Stavros Macrakis
Date: Thu, 16 Jun 2011 18:23:57 -0400
If you are in the Lisp mode Read-Evaluate-Print
Loop<http://en.wikipedia.org/wiki/Read-eval-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.
-s
On Thu, Jun 16, 2011 at 17:56, Edwin Woollett <woollett at charter.net> wrote:
> On June 16, 2011, Stavros Macrakis wrote:
> ------------------------------**-------------
>
>
> (cons '(mlist simp) (multiple-value-list (rename-file "foo.txt"
>> "bar.txt")))
>>
>
>
> But of course the individual elements of the result don't print correctly.
>>
> -------------------------
> When I try to use this in Maxima I get a lisp error:
> -------------------------
>
> (%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> rname ("foo.txt","bar.txt");
>
> Maxima encountered a Lisp error:
>
> Error in EVAL [or a callee]: The variable RNAME is unbound.
>
>
> Automatically continuing.
> To reenable the Lisp debugger set *debugger-hook* to nil.
>
> MAXIMA>
> Maxima encountered a Lisp error:
>
> Error in READ [or a callee]: A comma has appeared out of a backquote.
>
> Automatically continuing.
> To reenable the Lisp debugger set *debugger-hook* to nil.
>
> MAXIMA>
> "bar.txt"
> ------------------------------**--------
>
>
> I am using GCL in my windows binary
>>> Maxima simply as a way to learn some
>>> Lisp to Maxima tricks.
>>>
>>
> Both Raymond Toy and Leo Butler have provided methods
>>> of turning a Lisp list into a Maxima list.
>>>
>>
> gcl:rename_file returns three values.
>>>
>>
> How can I turn these into a Maxima list?
>>> -----------------------------
>>> (%i1) :lisp (rename-file "foo.txt" "bar.txt")
>>> #pbar.txt
>>> #pC:/work2/foo.txt
>>> #pC:/work2/bar.txt
>>>
>> -------------------
> Ted Woollett
> windows (gcl) 5.24.0
>
>
>
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>
>