🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: fj.mail-lists.reduce
1 messages
1 total messages Started by Francis J Wright Thu, 10 Sep 1992 15:59
Re: loop with out
#12
Author: Francis J Wright
Date: Thu, 10 Sep 1992 15:59
48 lines
2233 bytes
	From: "Z.Popowicz" <ZIEMEK@plwrtu11.bitnet>

	Who knows how to construct the loop with output files.?
	In the loop in the every step the new output file should be opened.
	The following example is wrong but it describes what I want

	for k:=1 : 1000 do << out "**/f(k)";sentence;shut "**/f(k)";>>;

	***************************************************************
	Z.Popowic

Here is another solution.  It works under PSL (on a SUN), and I think
has some chance of being portable.  The explicit call of mkfil may not
be necessary under other Lisps, but it should do no harm.  This is
similar to the suggestion by Rainer Schoepf, but it does not involve
writing any new procedures.

If I recall correctly, we suggested this technique in our book but
without the mkfil.  I think that version will work in implementations
that use the standard REDUCE code for in, out and shut, which calls
mkfil internally, whereas I think that PSL-REDUCE uses its own code.


symbolic operator mkfil;

for i := 1:3 do   % write some files
   begin scalar file;
      file := mkid(fjw, i);
      out <<mkfil file>>;
      write file;
%      write "END$";  % stops the read loop!
      shut <<mkfil file>>
   end;

for i := 1:3 do   % read them back
   begin scalar file;
      file := mkid(fjw, i);
      in <<mkfil file>>
   end;

END$


Dr. Francis J. Wright
Visiting from August 1992 to July 1993:	|  EMail: fjw@cbpfsu1.cat.cbpf.br
Centro Brasileiro de Pesquisas Fisicas	|  Phone: +55 (21) 541-0337 R 176
Rua Dr. Xavier Sigaud 150,  Botafogo	|  FAX:   +55 (21) 541-2047
22290 Rio de Janeiro - RJ,  BRAZIL	|  Telex: 21-22563 CBPQ BR
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads