append
and reverse
.
Format | append(?$L1, ?$L2, ?$L3) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
This is true when $L3 is the combined list of the elements in $L1 and $L2 in the original orders. | ||||||||||
> ?- append([1, 2, 3], [4, 5], X). X: < 1, 2, 3, 4, 5 > |
Format | revappend(?$L1, ?$L2, ?$L3) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
This is true when $L3 is the combined list of the elements in $L1 and $L2, in the reversed order as to $L1 and in the original order as to $L2. | ||||||||||
> ?- revappend([1, 2, 3], [4, 5], X). X: < 3, 2, 1, 4, 5 > |
Format | append_list(+$LL, -$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
This lets $L3 be the combined list of the elements in the elements in $LL. | |||||||
> ?- append_list([[1, 2], [3], [4, 5]],X). X: < 1, 2, 3, 4, 5 > |
Format | delete(+$List1, +$Elem, -$List2) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
This removes elements $Elem from $List and returns to $List2. | ||||||||||
> ?- delete([1, 2, 2, 4, 5], 2, X). X: < 1, 4, 5 > |
Format | reverse(?$L1, ?$L2) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
This is true when $L1 and $L2 have the same elements but in reversed orders each other. | |||||||
> ?- reverse([1, 2, 3, 4], X). X: < 4, 3, 2, 1 > |
Format | last(?$L, ?$X) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
This lets $X be the last element in $L. | |||||||
> ?- last([1, 2, 3, 4], X). X: 4 |
Format | member(?$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
This is true when $X is unified with an element in $L. | |||||||
> ?- member(X, [1, 2, 3]). X: 1 Enter ';' for more choices, otherwise press ENTER --> ; X: 2 Enter ';' for more choices, otherwise press ENTER --> ; X: 3 Enter ';' for more choices, otherwise press ENTER --> ; no |
Format | member_e(?$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | member/2 | ||||||
This is true when $X is equivalent to an element in $L. |
Format | member_i(?$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | member/2 | ||||||
This is true when $X is identical to an element in $L. |
Format | member_s(?$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | member/2 | ||||||
This is true when $X subsumes an element in $L. |
Format | member_sd(?$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | member/2 | ||||||
This is true when $X is subsumed by an element in $L. |
Format | memberchk(+$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | member/2 | ||||||
This is true when $X is unified with an element in $L. This does not succeeds more than once. | |||||||
> ?- memberchk(X, [1, 2, 3, 4]). X: 1 |
Format | memberchk_e(+$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | memberchk/2 | ||||||
This is true when $X is equivalent to an element in $L. This does not succeeds more than once. |
Format | memberchk_i(+$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | memberchk/2 | ||||||
This is true when $X is identical to an element in $L. This does not succeed more than once. |
Format | memberchk_s(+$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | memberchk/2 | ||||||
This is true when $X subsume an element in $L. This does not succeed more than once. |
Format | memberchk_sd(+$X, +$L) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | memberchk/2 | ||||||
This is true when $X is subsumed by an element in $L. This does not succeed more than once. |
Format | member_2(?$X1, +$L1, ?$X2, +$L2) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| ||||||||||||
See also | member/2 | ||||||||||||
This is true when $X1 and $X2 are unified with an element in $L1 and $L2 respectively. Where $X1 and $X2 are from the heads of $L1 and $L2 must be the same. | |||||||||||||
> ?- member_2(X, [1, 2], Y, [4, 5]). X: 1 Y: 4 Enter ';' for more choices, otherwise press ENTER --> ; X: 2 Y: 5 Enter ';' for more choices, otherwise press ENTER --> ; no |
Format | fast_member(+$L, ?$X) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | member/2 | ||||||
This is true when $X is unified with an element in $L. This is the same as 'member', but the order of the arguments is changed and this is faster. | |||||||
> ?- fast_member([1, 2, 3], X). X: 1 Enter ';' for more choices, otherwise press ENTER --> ; X: 2 Enter ';' for more choices, otherwise press ENTER --> ; X: 3 Enter ';' for more choices, otherwise press ENTER --> ; no |
Format | fast_member_2(+$L1, ?$X1, +$L2, ?$X2) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| ||||||||||||
See also | member_2/4 fast_member/2 | ||||||||||||
This is true when $X1 and $X2 are unified with elements in $L1 and $L2 respectively. Where $X1 and $X2 are from the heads of $L1 and $L2 must be the same. This is the same as 'member_2', but the order of the arguments is changed and this is faster. | |||||||||||||
> ?- fast_member_2([1, 2], X, [3, 4], Y). X: 1 Y: 3 Enter ';' for more choices, otherwise press ENTER --> ; X: 2 Y: 4 Enter ';' for more choices, otherwise press ENTER --> ; no |
Format | assoc(+$X, +$L, -$Y) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
This lets $Y be the second element of the pair whose first element is unified with $X. The 2-element pair (',/2') is the first proper one in $L. This does not succeed more than once. | ||||||||||
> ?- assoc(1, [(1, "a"), (2, "b")], X). X: "a" |
Format | assoc_e(+$X, +$L, -$Y) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
See also | assoc/3 | |||||||||
This lets $Y be the second element of the pair whose first element is equivalent to $X. The 2-element pair (',/2') is the first proper one in $L. This does not succeed more than once. |
Format | assoc_i(+$X, +$L, -$Y) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
See also | assoc/3 | |||||||||
This lets $Y be the second element of the pair whose first element is identical to $X. The 2-element pair (',/2') is the first proper one in $L. This does not succeed more than once. |
Format | remove_duplicates(+$L1, -$L2) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
This lets $L2 be the result of removing all equivalent duplicate elements in $L1. | |||||||
> ?- remove_duplicates([1, 2, 3, 2, 4], X). X: < 1, 3, 2, 4 > |
Format | listcommon(+$L1, +$L2, -$L3) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
Author | NISHIDA Kenji (nishiken@is.s.u-tokyo.ac.jp) | |||||||||
This lets $L3 be a list of all the elements that have equivalent elements both in $L1 and in $L2. | ||||||||||
> ?- listcommon([1, 2, 3, 4], [5, 4, 3], X). X: < 3, 4 > |
Format | flatten_list(+$L1, -$L2) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
This lets $L2 be a flattened list of $L1. | |||||||
> ?- flatten_list([1, [2, [3, 4], 5]], X). X: < 1, 2, 3, 4, 5 > |
Format | make_n_list(+$N, +$X, -$L) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
This lets $L be a list whose length is $N and all the elements are equivalent to $X. | ||||||||||
> ?- make_n_list(5, "hoge", X). X: < "hoge", "hoge", "hoge", "hoge", "hoge" > |
Format | make_num_list(+$FROM, +$BEFORE, -$RESULT) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
This lets $RESULT be a list whose elements are the integers from $FROM before $BEFORE. | ||||||||||
> ?- make_num_list(2, 5, X). X: < 2, 3, 4 > |
Format | length(+$L, -$N) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
This lets $N be the length of $L. | |||||||
> ?- length([3, 3, 3, 3], X). X: 4 |
Format | nth_elem(+$LIST, +$N, -$ELEM) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
This returns $Nth element of the list $LIST as $ELEM. | ||||||||||
> ?- nth([2, 4, 6, 8], 2, X). X: 6 |
Format | set_difference(+$Set1, +$Set2, -$Diff) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
This returns the elements of $Set1 not included in $Set2. | |||||||
> ?- set_difference([1, 2, 3, 4], [6, 4, 2], X). X: < 1, 3 > |
Format | set_difference_e(+$Set1, +$Set2, -$Diff) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | set_difference/3 | ||||||
This returns the elements of $Set1 not included in $Set2. |
Format | set_difference_i(+$Set1, +$Set2, -$Diff) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | set_difference/3 | ||||||
This returns the elements of $Set1 not included in $Set2. |
Format | input_list(+$STRING, -$LIST) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | output_list/2 | ||||||
Convert a string into a lilfes list |
Format | output_list(+$LIST, -$STRING) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
See also | lisp_to_lilfes/2 | ||||||
Convert a lilfes list into a lisp list |
Format | dlength(+Head, +Tail, -N) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
Returns the length of the difference list between Head and Tail. |
Format | dmember(+LHead, +LTail, ?E) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
as with member, but searches in a difference list given by 'LHead' and 'LTail' |
Format | dmember_2(+L1Head, +L1Tail, ?E1, +L2, ?E2) | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||||||||
as 'fast_member_2', but the first list is considered a difference list It is not necessary to give the 2nd list as difference list as well, as both lists are processed in tandem. |