Lists of numbers
Author(s): The CLIP Group.
This module implements some kinds of lists of numbers.
Usage and interface
- Library usage:
:- use_module(library(numlists)). - Exports:
- Predicates:
get_primes/2, sum_list/2, sum_list/3, sum_list_of_lists/2, sum_list_of_lists/3. - Regular Types:
intlist/1, numlist/1.
- Predicates:
- Imports:
- System library modules:
lists. - Packages:
prelude, nonpure, assertions, regtypes.
- System library modules:
Documentation on exports
PREDICATE
Usage:get_primes(N,Primes)
Computes the Nth first prime numbers in ascending order.
- The following properties should hold at call time:
(basic_props:int/1)N is an integer. - The following properties should hold upon exit:
(numlists:intlist/1)Primes is a list of integers.
PREDICATE
Usage:sum_list(List,N)
N is the total sum of the elements of List.
- The following properties should hold at call time:
(numlists:numlist/1)List is a list of numbers. - The following properties should hold upon exit:
(basic_props:num/1)N is a number.
PREDICATE
Usage:sum_list(List,N0,N)
N is the total sum of the elements of List plus N0.
- The following properties should hold at call time:
(numlists:numlist/1)List is a list of numbers.
(basic_props:num/1)N0 is a number. - The following properties should hold upon exit:
(basic_props:num/1)N is a number.
PREDICATE
Usage:sum_list_of_lists(Lists,N)
N is the total sum of the elements of the lists of Lists.
- The following properties should hold at call time:
(basic_props:list/2)List is a list of numlists. - The following properties should hold upon exit:
(basic_props:num/1)N is a number.
PREDICATE
Usage:sum_list_of_lists(Lists,N0,N)
N is the total sum of the elements of the lists of Lists plus N0.
- The following properties should hold at call time:
(basic_props:list/2)List is a list of numlists.
(basic_props:num/1)N0 is a number. - The following properties should hold upon exit:
(basic_props:num/1)N is a number.