🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1505

Re: a question about read

#1505
From: Richard A. O'Keefe
Date: Tue, 29 Sep 1992 02:23
34 lines
1839 bytes
In article <10468@uqcspe.cs.uq.oz.au>, pjr@cs.uq.oz.au (Peter Robinson (P.J.)) writes:
> How does your favourite Prolog behave in the following situation
> query:  ?- read(f(X)).
> input:  3.

DEC-10 Prolog, C Prolog, Quintus Prolog, &c all fail.

> Nu-Prolog :  
>       continue to input until the input is of the form f(term).

This is a *bug*.  Here's what the on-line manual says:

2?- man read.
read(Term)
read(Stream, Term)
(Non-logical).
Read a NU-Prolog Term, terminated by a period and white space, from the current
input  stream  (or  Stream).   All terms before the first syntactically correct
term are ignored.  If Term contains variables these are distinct from variables
not   in  the  term.   At  end-of-file,  read/1  and  read/2  return  the  atom
end_of_file.  Fails if Term will not unify with the term that is read.
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The manual describes the intended behaviour, which is just the same as other
Prolog systems.  Report the error.

I have just fixed the error in my copy of NU Prolog (it's in the file
sys/io.nl, and the error is really obvious).  I've notified the maintainer.

-- 
RMIT policy requires the use of Gender Inclusive Language in all publications
and in all information conveyed to students, staff, and potential job
applicants.  Lapses into English are the sole responsibility of the author.
The Constitution of Australia does _not_ guarantee Freedom of Speech.
Technical Details
Message-ID: <14755@goanna.cs.rmit.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!goanna!ok
References: <10468@uqcspe.cs.uq.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!goanna!ok
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.prolog
Subject: Re: a question about read
Message-ID: <14755@goanna.cs.rmit.oz.au>
Date: 29 Sep 92 02:23:08 GMT
References: <10468@uqcspe.cs.uq.oz.au>
Organization: Comp Sci, RMIT, Melbourne, Australia
Lines: 34