[ library(gfd_search) | Reference Manual | Alphabetic Index ]

nth_value(+Domain, ++N, -Value)

return the nth value in a domain
Domain
The domain list to select a value from
N
The position of the value to select
Value
The selected value

Description

Find the nth value in a domain given by an interval or a list of integers and intervals, as it is returned for example by ic's get_domain/2 or fd's ::/2.

Fail Conditions

N < 1 or there are less than N values in the domain.

Resatisfiable

no

Examples

% a typical use

	....
	get_domain(X, L),
	nth_value(L, 2, Value),
	....

See Also

fd : :: / 2, ic : get_domain / 2