[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: repeating
From: |
Cliff Bender |
Subject: |
Re: repeating |
Date: |
Wed, 15 Feb 2006 09:53:23 -0500 |
Thank you for your responses. I ended up fixing it by doing the following:
start :- repeat,
write('w00t: '),
read_line(Input),
once(parse(Input)),
fail.
parse(Input) :- Input=[stop,'.'],stop;
Input=[save,'.'],save;
q(Input,[]);
d(Input,[]);
write('I\'m terribly sorry. I don\'t understand the
meaning of that sentence'),nl.
Thank you for your help!
CB
On 2/15/06, Aleksander Saidi <address@hidden> wrote:
> Dear Cliff Bender,
>
> Try something like that :
>
> repeat, write('w00t: '), read(Input),(Input=stop,!,stop;write('I\'m
> terribly sorry. I don\'t understand the meaning of that sen'),nl).
>
> The thing is the 'cut' before stop.
>
> You may also write :
> repeat, write('w00t: '), read(Input),(once(Input=stop),stop;write('I\'m
> terribly sorry. I don\'t understand the meaning of that sen'),nl).
>
> 'once' is better since it has its own cut.
>
> OR :
> repeat, write('w00t: '), read(Input),(Input=stop -> stop;write('I\'m
> terribly sorry. I don\'t understand the meaning of that sen'),nl).
>
> if-else (given by '->') is equivalent (you better put '()' around the 3
> parts of a if-the-else)
>
> Regards.
>
> AS
>
>
> read_line is replaced by read.
>
> Cliff Bender a écrit :
>
> >Hello again,
> >
> >I'm hoping again that someone can help me. I'd like to repeat
> >indefinately until the user types in 'stop' in the following way:
> >
> >start :- repeat,
> > write('w00t: '),
> > read_line(Input),
> > (Input=[stop,'.'],stop;
> > write('I\'m terribly sorry. I don\'t understand the meaning
> >of that sentence'),nl).
> >
> >unfortunately it won't work correctly for some reason. am I using
> >repeat incorrectly? i got the read_line/1 from
> >http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/read_linepl.txt
> >
> >I appreciate the help!
> >
> >CB
> >
> >
> >_______________________________________________
> >Users-prolog mailing list
> >address@hidden
> >http://lists.gnu.org/mailman/listinfo/users-prolog
> >
> >
> >
>
> --
> Aleksander S. Saidi
> Ecole Centrale de Lyon
> Département Mathématiques-Informatique
> Mél : address@hidden
> Tél : 04.72.18.65.30, Fax : 04.78.33.16.15
>
>
>
>
- repeating, Cliff Bender, 2006/02/15
- Re: repeating, Aleksander Saidi, 2006/02/15
- Re: repeating,
Cliff Bender <=