IO 1 - backtracking!) York University- CSE 3401- V....

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Input & Output York University Department of Computer Science and Engineering York University- CSE 3401- V. Movahedi 1 08_IO
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Overview Read and write terms Read and write characters Reading English sentences Working with files Declaring operators [ref.: Clocksin- Chap. 5 ] York University- CSE 3401- V. Movahedi 2 08_IO
Background image of page 2
READ read(X) Will read the next term you type The term must be followed by a dot, and a space or newline (enter) The read term will be unified with X If X is not instantiated before, it will be instantiated with the term, and success (e=[X/term]) If instantiated before, If X can be matched with term, success. If not, fail. ‘read’ can not be re -satisfied (only once, will fail on
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: backtracking!) York University- CSE 3401- V. Movahedi 3 08_IO READ (cont.) Examples: :- read(X). 12. entered by user, on keyboard X = 12. :- X=5, read(X). 12. false. :- read(Y). [it, is, a, beautiful, day]. Y = [it, is, a, beautiful, day]. :- read(Z). 1+2 Z = 1+2. York University- CSE 3401- V. Movahedi 08_IO 4 WRITE write(X) If X is instantiated to a term before, the term will be displayed If not instantiated before, a uniquely numbered variable will be displayed write can not be re-satisfied (only once!) nl Means new line Writes a new line, all succeeding output apear on the next line of display York University- CSE 3401- V. Movahedi 08_IO 5...
View Full Document

Page1 / 5

IO 1 - backtracking!) York University- CSE 3401- V....

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online