list of loaded mac files



Hi Robert,
  Here is a sample of the kind of thing that happens.

(%i1) load("mload");
(%o1)                  /home/maxie/sen/.maxima/mload.mac
(%i2) system("ls file_*.mac");
file_name.mac  file_one.mac  file_two.mac
(%o2)                       #<process 1480 :EXITED>
(%i3) mload("file_name.mac");
Hello!
;

; Warning: This function is undefined:
;   MLISTP
(%o3)                                true
(%i4) loaded_files();
(%o4)                         [file_name, ., mac]
(%i5) mload("file_one.mac");
Hello!
(%o5)                                true
(%i6) loaded_files();
(%o6)                [file_name, ., mac, file_one, ., mac]


BTW, I can read the loaded files, so the 'mload' function works, but I
wanted to know how to read in formatted strings.

I suppose that lisp has something that works like the read version of

  printf

--something like 'scanf' in C.

Is that correct?

Does maxima also have such a function?

TIA,
  -sen
















On Sun, 12 Aug 2007, Robert Dodier wrote:

> On 8/7/07, sen1 at math.msu.edu <sen1 at math.msu.edu> wrote:
>
>> mload(filename):= block([s_1, fl_1],
>>                   fl_1: opena("loaded_file_names"),
>>                   s_1: load(filename), printf(fl_1, "~s", s_1),
>>                   close(fl_1))$
>> /* 'loaded_files()' is a command which reads the contents of
>> 'loaded_file_names' into a list */
>
>> (%i9) mload("file_name.mac");
>> Hello
>> (%o9)                                true
>> (%i10) loaded_files();
>> (%o10)                        [file_name, ., mac]
>
> Sheldon, sorry for the late reply. I am puzzled by this.
> The ~s in printf is supposed to print strings (both Lisp strings
> and Maxima strings) enclosed in double quotes,
> and read_list is supposed to read a quoted string as a single atom.
> What is the content of loaded_file_names ?
>
> Just to maintain a list of loaded files, it seems like it might
> be enough to have something like s_1 : load(...),
> loaded_files_list : cons(s_1, loaded_files_list)
> i.e. maintain the list in memory instead of as a file.
>
> best
>
> Robert Dodier
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>

-- 
  ---------------------------------------------------------------------------
  | Sheldon E. Newhouse            |    e-mail: sen1 at math.msu.edu           |
  | Mathematics Department         |       				   |
  | Michigan State University      | telephone: 517-355-9684                |
  | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562                |
  ---------------------------------------------------------------------------