Between

Description

K is an integer between the integers I and J inclusive in predicat mybetween(I,J,K).

Source: The Art of Prolog

Download

Program source code: between.pl

Listing

/*  
  mybetween(I,J,K) :- K is an integer between the integers I and J inclusive.
*/
     mybetween(I,J,I) :- I =< J.
     mybetween(I,J,K) :- I < J, I1 is I + 1, mybetween(I1,J,K).
 
%  Program 8.5   Generating a range of integers

Comments

pl/prolog/pllib/between.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0