IF Computer > MINERVA > Manual > Reference > Predicates > Arithmetic evaluation > for/3

for/3

MINERVA
ifcomputer logo
f
Expert Services on the Web

generates an ordered sequence of numbers.

for(+Start, ?Counter, +End)

for/3 generates an ascending ordered sequence of integers with starting value Start and ending value End, where the step between two numbers is 1. If End is less than Start then the predicate fails.

Arguments

Start                  integer
Counter                integer
End                    integer

Examples

% occurs_in(+Arg, +Term)
% check if Term occurs in Term
occurs_in(Arg, Term) :-
	Arg == Term, !.
occurs_in(Arg, Term) :-
	compound(Term), !,
	functor(Term, _, Arity),
	for(1, I, Arity),
	arg(I, Term, SubTerm),
	occurs_in(Arg, SubTerm), !.

Standard

This predicate is not part of the ISO-Prolog Standard.

See also

is/2.

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/arithm_eval/for/print_en.html
published 2008/6/30 update 1997/6/22 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 info@ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS