intersect

The intersect function takes the list intersection of two lists. It is a special case of intersectBy, which allows the programmer to supply their own equality test.
Examples
>>> [1,2,3,4] `intersect` [2,4,6,8]
[2,4]
If equal elements are present in both lists, an element from the first list will be used, and all duplicates from the second list quashed:
>>> import Data.Semigroup

>>> intersect [Arg () "dog"] [Arg () "cow", Arg () "cat"]
[Arg () "dog"]
However if the first list contains duplicates, so will the result.
>>> "coot" `intersect` "heron"
"oo"

>>> "heron" `intersect` "coot"
"o"
If the second list is infinite, intersect either hangs or returns its first argument in full. Otherwise if the first list is infinite, intersect might be productive:
>>> intersect [100..] [0..]
[100,101,102,103...

>>> intersect [0] [1..]
* Hangs forever *

>>> intersect [1..] [0]
* Hangs forever *

>>> intersect (cycle [1..3]) [2]
[2,2,2,2...
The intersect function takes the list intersection of two lists. For example,
>>> [1,2,3,4] `intersect` [2,4,6,8]
[2,4]
If the first list contains duplicates, so will the result.
>>> [1,2,2,3,4] `intersect` [6,4,4,2]
[2,2,4]
It is a special case of intersectBy, which allows the programmer to supply their own equality test. If the element is found in both the first and the second list, the element from the first list will be used.
An alias for intersection.
List intersection: the set of elements that occur in both lists. See also intersectBy
O(n log n + m log m). Intersect the values in two heaps, returning the value in the left heap that compares as equal
O(n+m). Intersection of sorted lists. If the first list contains duplicates, so will the result.
Return all elements of an infinite list, which are simultaneously members of a finite list.
The intersect function takes the list intersection of two lists. It is a special case of intersectBy, which allows the programmer to supply their own equality test. For example,
>>> [1,2,3,4] `intersect` [2,4,6,8]
[2,4]
If equal elements are present in both lists, an element from the first list will be used, and all duplicates from the second list quashed:
>>> import Data.Semigroup

>>> intersect [Arg () "dog"] [Arg () "cow", Arg () "cat"]
[Arg () "dog"]
However if the first list contains duplicates, so will the result.
>>> "coot" `intersect` "heron"
"oo"

>>> "heron" `intersect` "coot"
"o"
If the second list is infinite, intersect either hangs or returns its first argument in full. Otherwise if the first list is infinite, intersect might be productive:
>>> intersect [100..] [0..]
[100,101,102,103...

>>> intersect [0] [1..]
* Hangs forever *

>>> intersect [1..] [0]
* Hangs forever *

>>> intersect (cycle [1..3]) [2]
[2,2,2,2...
The same as intersectAll, except that it additionally removes any duplicate rows.
Intersection of two relations.
Intersect binary operator on SubQuery
Calculate an intersect between two boundingboxes.
A pair (a, b) such that a divided by b is the X coordinate of the intersection of a given line and the horizontal line at distance d above the X axis. Derivation of the formula: The intersection point (xt, yt) satisfies the following equalities:
yt = d
(yt - y) (xf - x) = (xt - x) (yf - y)
hence
(yt - y) (xf - x) = (xt - x) (yf - y)
(d - y) (xf - x) = (xt - x) (yf - y)
(d - y) (xf - x) + x (yf - y) = xt (yf - y)
xt = ((d - y) (xf - x) + x (yf - y)) / (yf - y)
General remarks: The FOV agrees with physical properties of tiles as diamonds and visibility from any point to any point. A diamond is denoted by the left corner of its encompassing tile. Hero is at (0, 0). Order of processing in the first quadrant rotated by 45 degrees is
45678
123
@
so the first processed diamond is at (-1, 1). The order is similar as for the restrictive shadow casting algorithm and reversed wrt PFOV. The fast moving line when scanning is called the shallow line, and it's the one that delimits the view from the left, while the steep line is on the right, opposite to PFOV. We start scanning from the left. The PointI (Enum representation of Point) coordinates are cartesian. The Bump coordinates are cartesian, translated so that the hero is at (0, 0) and rotated so that he always looks at the first (rotated 45 degrees) quadrant. The (Progress, Distance) cordinates coincide with the Bump coordinates, unlike in PFOV. Debug: check that the line fits in the upper half-plane.
Intersection of topologies. | See intersect.
Intersection of trees. The intersections are the largest subtrees sharing the same leaf set. Degree two nodes are pruned with prune. Return Left if:
  • the intersection of leaves is empty.
Try to find the intersection point of two ground paths (i.e. ignoring altitude). Returns the distance of the intersection point along each path using a modified Newton-Raphson method. If the two paths are fairly straight and not close to parallel then this will converge rapidly. The algorithm projects great-circle paths forwards using the bearing at the estimate to find the estimated intersection, and then uses the distances to this intersection as the next estimates. If either estimate departs from its path validity then Nothing is returned.
Intersection of two relations.
O(n*m). Returns the slist intersection of two slists.
>>> intersect (slist [1,2,3,4]) (slist [2,4,6,8])
Slist {sList = [2,4], sSize = Size 2}
If the first list contains duplicates, so will the result.
>>> intersect (slist [1,2,2,3,4]) (slist [6,4,4,2])
Slist {sList = [2,2,4], sSize = Size 3}
If the first slist is infinite, so will be the result. If the element is found in both the first and the second slist, the element from the first slist will be used. It is a special case of intersectBy.
Calculates intersection between two lists. Order of elements is taken from first list