Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:file_operations [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== File operations ======
 +{{tag>​patterns read/​write}}
 +===== Description =====
 +Simple program to file operations
 +
 +**Source**: ​ PrologTutorial (on-line tutorial)
 +===== Download =====
 +Program source code: {{file_operations.pl}}
 +===== Listing =====
 +<code prolog>
 +/* prolog ​ tutorial ​ 2.10 */
 +
 +browse :- 
 +        seeing(Old), ​     /* save for later */ 
 +        see(user), ​
 +        write('​Enter name of file to browse: '), read(File), ​
 +        see(File), ​       /* open this file */ 
 +        repeat, ​
 +        read(Data), ​      /* read from File */ 
 +        process(Data), ​   ​
 +        seen,             /* close File */ 
 +        see(Old), ​         /*  previous read source */ 
 +        !.                /* stop now */ 
 +
 +process(end_of_file) :- !. 
 +process(Data) :-  write(Data),​ write('​.'​),​ nl, fail. 
 +
 +
 +my_save(ToFile) :-      ​
 +       ​telling(Old), ​     /* current write output */ 
 +       ​tell(ToFile), ​     /* open this file */ 
 +       ​listing, ​          /* list all clauses in memory */ 
 +       ​told, ​             /* close ToFile */ 
 +       ​tell(Old). ​        /* resume this output */ </​code>​
 +===== Comments =====
  
pl/prolog/pllib/file_operations.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0