length/2

Tests or gets the length of a list or generates a list

length(List,Length) -(i,o),(o,i)

?List <list> or <variable>

?Length <integer> or <variable>

Compatibility: LPA Win-Prolog (partially).

Remarks:

1) This predicate can be used to get ot check the length of a list, or to generate lists of a given length. When Length is an integer, a list of distinct variables is generated and unified with List. When Length is an unbound variable, the length of List is computed and unified with Length.

2) In LPA Win-Prolog this predicate is non-deterministic, and can generate successive lengths and lists on backtracking. However, in G.I.S. Prolog, it is deterministic and does not work for the flow-pattern "-(o,o)".