<HTML> <HEAD> <!-- Created by texi2html 1.56k + clip patches and <A href="http://www.clip.dia.fi.upm.es/Software">lpdoc</A> from ciao.texi on 28 January 2007 --> <LINK rel="stylesheet" href="ciao.css" type="text/css"> <TITLE>The Ciao Prolog System - Lists of numbers</TITLE> </HEAD> <BODY> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_166.html">previous</A>, <A HREF="ciao_168.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. <P><HR><P> <H1><A NAME="SEC692" HREF="ciao_toc.html#TOC692">Lists of numbers</A></H1> <P> <A NAME="IDX7816"></A> <P> <STRONG>Author(s):</STRONG> The CLIP Group. <P> <STRONG>Version:</STRONG> 1.9#237 (2003/12/22, 18:23:36 CET) <P> This module implements some kinds of lists of numbers. <UL> <LI><A HREF="ciao_167.html#SEC693">Usage and interface (numlists)</A> <LI><A HREF="ciao_167.html#SEC694">Documentation on exports (numlists)</A> </UL> <H2><A NAME="SEC693" HREF="ciao_toc.html#TOC693">Usage and interface (<CODE>numlists</CODE>)</A></H2> <div class="cartouche"> <UL> <LI><STRONG>Library usage:</STRONG> <CODE>:- use_module(library(numlists)).</CODE> <LI><STRONG>Exports:</STRONG> <UL> <LI><EM>Predicates:</EM> <A NAME="IDX7817"></A> <CODE>get_primes/2</CODE>, <A NAME="IDX7818"></A> <CODE>sum_list/2</CODE>, <A NAME="IDX7819"></A> <CODE>sum_list/3</CODE>, <A NAME="IDX7820"></A> <CODE>sum_list_of_lists/2</CODE>, <A NAME="IDX7821"></A> <CODE>sum_list_of_lists/3</CODE>. <LI><EM>Regular Types:</EM> <A NAME="IDX7822"></A> <CODE>intlist/1</CODE>, <A NAME="IDX7823"></A> <CODE>numlist/1</CODE>. </UL> <LI><STRONG>Other modules used:</STRONG> <UL> <LI><EM>System library modules:</EM> <A NAME="IDX7824"></A> <CODE>lists</CODE>. </UL> </UL> </div class="cartouche"> <H2><A NAME="SEC694" HREF="ciao_toc.html#TOC694">Documentation on exports (<CODE>numlists</CODE>)</A></H2> <P> <A NAME="IDX7825"></A> <A NAME="IDX7826"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>get_primes/2:</B> <DD><A NAME="IDX7827"></A> <P> <STRONG>Usage:</STRONG> <CODE>get_primes(N, Primes)</CODE> <UL> <LI><EM>Description:</EM> Computes the <CODE>N</CODE>th first prime numbers in ascending order. <LI><EM>The following properties should hold at call time:</EM> <CODE>N</CODE> is an integer. (<CODE>basic_props:int/1</CODE>) <LI><EM>The following properties should hold upon exit:</EM> <CODE>Primes</CODE> is a list of integers. (<CODE>numlists:intlist/1</CODE>) </UL> </DL> <P> <A NAME="IDX7828"></A> <A NAME="IDX7829"></A> <DL> <DT><span class="define">REGTYPE:</span> <B>intlist/1:</B> <DD><A NAME="IDX7830"></A> <P> <STRONG>Usage:</STRONG> <CODE>intlist(X)</CODE> <UL> <LI><EM>Description:</EM> <CODE>X</CODE> is a list of integers. </UL> </DL> <P> <A NAME="IDX7831"></A> <A NAME="IDX7832"></A> <DL> <DT><span class="define">REGTYPE:</span> <B>numlist/1:</B> <DD><A NAME="IDX7833"></A> <P> <STRONG>Usage:</STRONG> <CODE>numlist(X)</CODE> <UL> <LI><EM>Description:</EM> <CODE>X</CODE> is a list of numbers. </UL> </DL> <P> <A NAME="IDX7834"></A> <A NAME="IDX7835"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>sum_list/2:</B> <DD><A NAME="IDX7836"></A> <P> <STRONG>Usage:</STRONG> <CODE>sum_list(List, N)</CODE> <UL> <LI><EM>Description:</EM> <CODE>N</CODE> is the total sum of the elements of <CODE>List</CODE>. <LI><EM>The following properties should hold at call time:</EM> <CODE>List</CODE> is a list of numbers. (<CODE>numlists:numlist/1</CODE>) <LI><EM>The following properties should hold upon exit:</EM> <CODE>N</CODE> is a number. (<CODE>basic_props:num/1</CODE>) </UL> </DL> <P> <A NAME="IDX7837"></A> <A NAME="IDX7838"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>sum_list/3:</B> <DD><A NAME="IDX7839"></A> <P> <STRONG>Usage:</STRONG> <CODE>sum_list(List, N0, N)</CODE> <UL> <LI><EM>Description:</EM> <CODE>N</CODE> is the total sum of the elements of <CODE>List</CODE> plus <CODE>N0</CODE>. <LI><EM>The following properties should hold at call time:</EM> <CODE>List</CODE> is a list of numbers. (<CODE>numlists:numlist/1</CODE>) <CODE>N0</CODE> is a number. (<CODE>basic_props:num/1</CODE>) <LI><EM>The following properties should hold upon exit:</EM> <CODE>N</CODE> is a number. (<CODE>basic_props:num/1</CODE>) </UL> </DL> <P> <A NAME="IDX7840"></A> <A NAME="IDX7841"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>sum_list_of_lists/2:</B> <DD><A NAME="IDX7842"></A> <P> <STRONG>Usage:</STRONG> <CODE>sum_list_of_lists(Lists, N)</CODE> <UL> <LI><EM>Description:</EM> <CODE>N</CODE> is the total sum of the elements of the lists of <CODE>Lists</CODE>. <LI><EM>The following properties should hold at call time:</EM> <CODE>List</CODE> is a list of <CODE>numlist</CODE>s. (<CODE>basic_props:list/2</CODE>) <LI><EM>The following properties should hold upon exit:</EM> <CODE>N</CODE> is a number. (<CODE>basic_props:num/1</CODE>) </UL> </DL> <P> <A NAME="IDX7843"></A> <A NAME="IDX7844"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>sum_list_of_lists/3:</B> <DD><A NAME="IDX7845"></A> <P> <STRONG>Usage:</STRONG> <CODE>sum_list_of_lists(Lists, N0, N)</CODE> <UL> <LI><EM>Description:</EM> <CODE>N</CODE> is the total sum of the elements of the lists of <CODE>Lists</CODE> plus <CODE>N0</CODE>. <LI><EM>The following properties should hold at call time:</EM> <CODE>List</CODE> is a list of <CODE>numlist</CODE>s. (<CODE>basic_props:list/2</CODE>) <CODE>N0</CODE> is a number. (<CODE>basic_props:num/1</CODE>) <LI><EM>The following properties should hold upon exit:</EM> <CODE>N</CODE> is a number. (<CODE>basic_props:num/1</CODE>) </UL> </DL> <P><HR><P> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_166.html">previous</A>, <A HREF="ciao_168.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. </BODY> </HTML>