Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Input and Output Notes for Ch.6 of Bratko For CSCE 580 Sp03 Marco Valtorta.

Similar presentations


Presentation on theme: "UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Input and Output Notes for Ch.6 of Bratko For CSCE 580 Sp03 Marco Valtorta."— Presentation transcript:

1 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Input and Output Notes for Ch.6 of Bratko For CSCE 580 Sp03 Marco Valtorta

2 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Opening and Closing Files Current input stream: –see( Filename). –see( user). –seen. Current output stream: –tell( Filename). –tell( user). –told.

3 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Reading and Writing Terms read( X). –reads a term from the current input stream –deterministic: no backtracking on failure –X = end_of_file when at eof write( X). –displays term X

4 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Manipulating Characters put( C). –C is an ASCII code get0( C). –C is instantiated to an ASCII code get( C). –Like get0( C), but skips blanks

5 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Constructing and Decomposing Atoms name/2 –Name( Atom, L) if L is the list of ASCII codes of the characters that make up Atom –name is bi-directional

6 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Reading Programs consult/1 –always use forward slashes in SWI for portability qcompile/1 –creates a quick loading file (.qlf) –qlf files contain intermediate (WAM) code, which loads faster is portable is hard to read 6 ?- qcompile('Ch6_1.pl'). % c:/marco/csce580/prolog/ch6/ch6_1.pl *qcompiled* 0.00 sec, 128 bytes See Section 4.3 of SWI-Prolog manual for details


Download ppt "UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Input and Output Notes for Ch.6 of Bratko For CSCE 580 Sp03 Marco Valtorta."

Similar presentations


Ads by Google