Subject: Re: About read predicate and linux version.

From: Paulo Jorge Lopes de Moura <[email-masked]>
Date: Thu, 24 Feb 2000 14:20:05 +0000

Alfonso Ortega de la Puente wrote:
> 
>         I'm using swi-prolog 3.2.3 for Windows. Is there any reason for the following behaviour?
> 
>         treat_number:-
>                 read(A),
>                 A < 0
>                 ->
>                         B is A * 3, write(B) ;
>                         C is A * 4, write(C).
> 
>         If a number is read from a file by means of the see/seen mechanism, why the variable A in the last sentence remains unbound?

Maybe what you want is:

	treat_number:-
		read(A),
		(A < 0 ->
			B is A * 3, write(B)
			;
			C is A * 4, write(C)).
 
Regards,

Paulo

-----------------------------------------------------------
Paulo Jorge Lopes de Moura
Dep. of Mathematics and Informatics   Office 4.32 Ext. 3251
University of Beira Interior          Phone: +351 275319700
6200 Covilhã                          Fax:   +351 275319732
Portugal

mailto:[email-masked]
http://www.ci.uc.pt/logtalk/pmoura.html
-----------------------------------------------------------