Add example values and results for theory filters (#72087)
(cherry picked from commit 69c3e5644c
)
This commit is contained in:
parent
49504da1ed
commit
c24bdfa7df
1 changed files with 14 additions and 1 deletions
|
@ -903,24 +903,37 @@ You can select or combine items from sets or lists.
|
||||||
|
|
||||||
To get a unique set from a list::
|
To get a unique set from a list::
|
||||||
|
|
||||||
|
# list1: [1, 2, 5, 1, 3, 4, 10]
|
||||||
{{ list1 | unique }}
|
{{ list1 | unique }}
|
||||||
|
# => [1, 2, 5, 3, 4, 10]
|
||||||
|
|
||||||
To get a union of two lists::
|
To get a union of two lists::
|
||||||
|
|
||||||
|
# list1: [1, 2, 5, 1, 3, 4, 10]
|
||||||
|
# list2: [1, 2, 3, 4, 5, 11, 99]
|
||||||
{{ list1 | union(list2) }}
|
{{ list1 | union(list2) }}
|
||||||
|
# => [1, 2, 5, 1, 3, 4, 10, 11, 99]
|
||||||
|
|
||||||
To get the intersection of 2 lists (unique list of all items in both)::
|
To get the intersection of 2 lists (unique list of all items in both)::
|
||||||
|
|
||||||
|
# list1: [1, 2, 5, 3, 4, 10]
|
||||||
|
# list2: [1, 2, 3, 4, 5, 11, 99]
|
||||||
{{ list1 | intersect(list2) }}
|
{{ list1 | intersect(list2) }}
|
||||||
|
# => [1, 2, 5, 3, 4]
|
||||||
|
|
||||||
To get the difference of 2 lists (items in 1 that don't exist in 2)::
|
To get the difference of 2 lists (items in 1 that don't exist in 2)::
|
||||||
|
|
||||||
|
# list1: [1, 2, 5, 1, 3, 4, 10]
|
||||||
|
# list2: [1, 2, 3, 4, 5, 11, 99]
|
||||||
{{ list1 | difference(list2) }}
|
{{ list1 | difference(list2) }}
|
||||||
|
# => [10]
|
||||||
|
|
||||||
To get the symmetric difference of 2 lists (items exclusive to each list)::
|
To get the symmetric difference of 2 lists (items exclusive to each list)::
|
||||||
|
|
||||||
|
# list1: [1, 2, 5, 1, 3, 4, 10]
|
||||||
|
# list2: [1, 2, 3, 4, 5, 11, 99]
|
||||||
{{ list1 | symmetric_difference(list2) }}
|
{{ list1 | symmetric_difference(list2) }}
|
||||||
|
# => [10, 11, 99]
|
||||||
|
|
||||||
.. _math_stuff:
|
.. _math_stuff:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue