bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The editor does not always offer other solutions.


From: Daniel Diaz
Subject: Re: The editor does not always offer other solutions.
Date: Mon, 9 Jan 2023 09:33:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

Hi,

this is due to 'return' (\n) which ends the read(X) and remains in the keyboard buffer - when the first solution of name (bob) is displayed, the return is send to the top-level which ends the alternatives.

To consume the return, you can use:

| ?- read(Y), get_char(_), name(X).

Daniel


Le 08/01/2023 à 16:46, one_of_us a écrit :

o@Kiki:~/prolog/gen_rythm$ uname -a
Linux Kiki 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux

o@Kiki:~/prolog/gen_rythm$ gprolog
GNU Prolog 1.4.5 (64 bits)
Compiled Feb 23 2020, 20:14:50 with gcc
By Daniel Diaz
Copyright (C) 1999-2020 Daniel Diaz
| ?- [user].
compiling user for byte code...
name(bob).
name(ann).
name(joe).
end_of_file.
user compiled, 3 lines read - 292 bytes written, 45418 ms

yes
| ?- name(X). %
              %
X = bob ? ;   % Here is possibility
              % to request another
X = ann ? ;   % solutions.
              % It is good.
X = joe       %

yes
| ?- read(Y), name(X). %
tratata.               % Here is not such possibility.
                       % Why?
X = bob                % Is it a bug?
Y = tratata ?          %

yes
| ?-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]