Re: for loop in prolog
- From: "Diogo Bastos" <damrho@xxxxxxxxxx>
- Date: Mon, 16 Jan 2006 19:43:00 -0000
% my_for(start_value,end_value,increment,action)
my_for(V,V,_,_) :- !.
my_for(Start,End,Inc,Action) :-
End > Start,
NewValue is Start+Inc,
call(Action),
my_for(NewValue,End,Inc,Action).
"nobody" <nobody@xxxxxxxxxxxxxx> escreveu na mensagem
news:pan.2006.01.10.19.29.18.959870@xxxxxxxxxxxxxxxxx
> 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...
.
- Follow-Ups:
- Re: for loop in prolog
- From: Jan Wielemaker
- Re: for loop in prolog
- References:
- for loop in prolog
- From: nobody
- for loop in prolog
- Prev by Date: Re: problem:4x4magicSquare in prolog
- Next by Date: Re: problem:4x4magicSquare in prolog
- Previous by thread: Re: for loop in prolog
- Next by thread: Re: for loop in prolog
- Index(es):
Relevant Pages
|