How to open a file given its pathname relative to the current batch script



On Tue, Nov 24, 2009 at 2:58 PM, Manuel Fiorelli
<manuel.fiorelli at gmail.com> wrote:

> 2009/11/24 Robert Dodier <robert.dodier at gmail.com>:
>> (defun $relative_filename (name) (namestring ($filename_merge
>> ($extract_filename $x) name)))
>
> The function does it's job! However, I receive the following warning:
>
> $EXTRACT_FILENAME
> ; in: LAMBDA NIL
> ; ? ? (MAXIMA::$EXTRACT_FILENAME MAXIMA::$X)
> ;
> ; caught WARNING:
> ; ? undefined variable: $X

Well, you could make it go away by either throwing
(declare (special $x)) at the top of the function e.g.
(defun $relative_filename (name) (declare (special $x)) (... rest of
function here ...))
or by making $x an argument of $relative_filename.

Again I'm sorry that this is far from straightforward.

> (%i12) parametri:read_list(filename_merge(extract_filename(x),musa.model))
> numericalio: expected a string, instead found a ?pathname

OK, I see.

best

Robert Dodier