[ library(sd) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

deleteff(-Min, +List, -Rest)

Pick minimum domain size element from a list (first fail principle)
Min
Smallest list element in terms of domain size
List
List of domain variables or constants
Rest
Remaining list without smallest element

Description

Extracts from a list of domain variables (or constants) the first element with the smallest domain. This element is returned as Min, and the remaining list without this element is returned as Rest. This predicate is useful for implementing the first-fail-principle in a search procedure, i.e. labeling the variable with the smallest domain first. E.g.
	labelingff(List) :-
		( deleteff(X, List, Rest) ->
		    indomain(X),
		    labelingff(Rest)
		;
		    true
		).
	

Fail Conditions

List is empty

See Also

get_domain_size / 2