Re: for loop in prolog
nobody wrote:
hi to all,
How could i implement a for loop in prolog. Let's say for
example that i have an integer variable X and i want to repeat X
times a specific action. Any idea welcome...
?- between(1, 5, X), write(X), nl, fail.
1
2
3
4
5
No
% The fail/0 prevents my prolog processor from asking for each X
% whether to continue or not.
Roland
.
Relevant Pages
- for loop in prolog
... How could i implement a for loop in prolog. ... example that i have an integer variable X and i want to repeat X ... Prev by Date: ... (comp.lang.prolog) - Re: it will cautiously hand likely and merges our bottom, absent accountants in respect of a hardwar
... Nobody outside specialise occupational and reveals our governing, ... mixed commands past a charter. ... it'll actually repeat the pencil. ... Nobody fatally arrange at least eager nursing tours. ... (sci.crypt) - Re: acceptance of forth
... before entering an infinite loop (i.e. ... repeat jumps to after while instead of after begin?) ... begin..while..repeat has multiple templates (which, ... circumstances where I consulted the books. ... (comp.lang.forth) - Re: A Class of Non-Halting TMs
... >> Step, current state, input, and tape position. ... and so it will loop forever" may not be true. ... if you take a nonhalting machine history which eventually ... My method will say steps 7-8 repeat: ... (comp.theory) - Re: RFC: About error handling - WAS: Re: A remobjects wtf...
... Of course in this example (and probably in most cases, as there is some condition that determines whether you need to retry) it could be replaced with a test for a valid BaudRate in 'until'. ... You could be against repeat and while in general with the same argument. ... I would also say that your 'Retry' examples resembles these much more (You wouldn't need 'goto Succeeded', would you?): ... 'break') applies to this 'fake' loop, ... (borland.public.delphi.non-technical) |
|