Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:integers_set [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Integers set ======
 +{{tag>​arithmetic lists}}
 +===== Description =====
 +Generating a list of integers in a given range.
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{integers_set.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 +   ​range(M,​N,​Ns) :- Ns is the list of integers between M and N inclusive.
 +*/
 +     ​range(M,​N,​[M|Ns]) :- M < N, M1 is M+1, range(M1,​N,​Ns).
 +     ​range(N,​N,​[N]).
 +
 +%  Program 8.12   ​Generating a list of integers in a given range
 +
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/integers_set.txt · ostatnio zmienione: 2019/06/27 15:50 (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