úÎ!ľžŽzm      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklNone"#%,/17HMPX_kíslist-Data type that represents lists size/lengths. List  length  Size  []  0  Size 0  [1..10]  10  Size 10  [1..]  hangs  Infinity BNote, that size is not suppose to have negative value, so use the  constructor carefully.slist Finite sizeslistInfinite size.slistAReturns the list of sizes from zero to the given one (including).sizes $ Size 3[Size 0,Size 1,Size 2,Size 3] >> sizes Infinity [Size 0, Size 1, ..., Size m , Infinity] slist6The minimum possible size for the list is empty list: Size 0 The maximum possible size is .slist5Efficient implementations of numeric operations with s.Any operations with  size results into . TODO: checking on overflow when n or o sizes.(c) 2019 vrom911MPL-2.0'Veronika Romashkina <vrom911@gmail.com>None"#%,/17HMPVX_kŤžZ slistcData type that represents sized list. Size can be both finite or infinite, it is established using  data type. slistO(n) . Constructs   from the given list. slist [1..5]+Slist {sList = [1,2,3,4,5], sSize = Size 5}Note: works with finite lists. Use   to construct infinite lists. slistO(1) . Constructs   from the given list. ?>> infiniteSlist [1..] Slist {sList = [1..], sSize = Infinity} Note: works with infinite lists. Use   to construct finite lists. slistO(1) . Creates  ) with a single element. The size of such   is always equals to Size 1.one "and only",Slist {sList = ["and only"], sSize = Size 1}slist^Returns an infinite slist of repeated applications of the given function to the start element: %iterate f x == [x, f x, f (f x), ...] >> iterate (+1) 0 Slist {sList = [0..], sSize = } take 5 $ iterate ('a':) "a"?Slist {sList = ["a","aa","aaa","aaaa","aaaaa"], sSize = Size 5}Note: p` is lazy, potentially leading to thunk build-up if the consumer doesn't force each iterate. See ' for a strict variant of this function.slist^Returns an infinite slist of repeated applications of the given function to the start element: &iterate' f x == [x, f x, f (f x), ...] >> iterate' (+1) 0 Slist {sList = [0..], sSize = } take 5 $ iterate' ('a':) "a"?Slist {sList = ["a","aa","aaa","aaaa","aaaaa"], sSize = Size 5} is the strict version of .cIt ensures that the result of each application of force to weak head normal form before proceeding.slistO(1)D. Creates an infinite slist with the given element at each position. >>  repeat 42% Slist {sList = [42, 42 ..], sSize = } take 6 $ repeat 'm'(Slist {sList = "mmmmmm", sSize = Size 6}slistO(n)?. Creates a finite slist with the given value at each position.replicate 3 'o'%Slist {sList = "ooo", sSize = Size 3}replicate (-11) "hmm""Slist {sList = [], sSize = Size 0}slistŒTies a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is the identity on infinite lists.take 23 $ cycle (slist "pam "):Slist {sList = "pam pam pam pam pam pam", sSize = Size 23} >> cycle $   [1..] Slist {sList = [1..], sSize = } slistO(1)*. Returns the length of a structure as an q . On infinite lists returns the qs m. len $ one 421len $ slist [1..3]3len $ infiniteSlist [1..]9223372036854775807slistO(1). Returns the  of the slist.size $ slist "Hello World!"Size 12size $ infiniteSlist [1..]InfinityslistO(1) . Checks if   is emptyisEmpty memptyTrueisEmpty $ slist []TrueisEmpty $ slist "Not Empty"FalseslistO(1)8. Extracts the first element of a slist. Uses not total r function, so use wisely.It is recommended to use  instead.head $ slist "qwerty"'q'head $ infiniteSlist [1..]1 head mempty'*** Exception: Prelude.head: empty listslistO(1)4. Extracts the first element of a slist if possible.safeHead $ slist "qwerty"Just 'q'safeHead $ infiniteSlist [1..]Just 1safeHead memptyNothingslistO(n)6. Extracts the last element of a list. Uses not total s function, so use wisely.It is recommended to use  insteadlast $ slist "qwerty"'y' last mempty'*** Exception: Prelude.last: empty list >> last $ infiniteSlist [1..] <hangs> slistO(n)2. Extracts the last element of a list if possible.safeLast $ slist "qwerty"Just 'y'safeLast memptyNothingsafeLast $ infiniteSlist [1..]NothingslistO(1)H. Returns a slist with all the elements after the head of a given slist. tail mempty"Slist {sList = [], sSize = Size 0}tail $ slist "Hello"&Slist {sList = "ello", sSize = Size 4} >> tail $   [0..] Slist {sList = [1..], sSize = } slistO(n)8. Return all the elements of a list except the last one. init mempty"Slist {sList = [], sSize = Size 0}init $ slist "Hello"&Slist {sList = "Hell", sSize = Size 4} >> init $   [0..] Slist {sList = [0..], sSize = } slistO(1)L. Decomposes a slist into its head and tail. If the slist is empty, returns t. uncons memptyNothinguncons $ one 'a'-Just ('a',Slist {sList = "", sSize = Size 0}) >>  uncons $   [0..]( Just (0, Slist {sList = [1..], sSize = }) slistO(n):. Applies the given function to each element of the slist. ‹map f (slist [x1, x2, ..., xn]) == slist [f x1, f x2, ..., f xn] map f (infiniteSlist [x1, x2, ...]) == infiniteSlist [f x1, f x2, ...]slistO(n)5. Returns the elements of the slist in reverse order.reverse $ slist "Hello"'Slist {sList = "olleH", sSize = Size 5}reverse $ slist "wow"%Slist {sList = "wow", sSize = Size 3}Note: 0 slist can not be calculated on infinite slists. >>  reverse $   [1..] <hangs> Use  to not hang on infinite slists.slistO(n)c. Returns the elements of the slist in reverse order. On infinite slists returns the initial slist.safeReverse $ slist "Hello"'Slist {sList = "olleH", sSize = Size 5} >>  reverse $   [1..] Slist {sList = [1..], sSize = } slistO(n)]. Takes an element and a list and intersperses that element between the elements of the list.intersperse ',' $ slist "abcd")Slist {sList = "a,b,c,d", sSize = Size 7}intersperse '!' mempty"Slist {sList = "", sSize = Size 0} >> intersperse 0 $   [1,1..]% Slist {sList = [1,0,1,0..], sSize = } !slistO(n)L. Inserts the given slist in between the slists and concatenates the result. ,intercalate x xs = concat (intersperse x xs)Nintercalate (slist ", ") $ slist [slist "Lorem", slist "ipsum", slist "dolor"]6Slist {sList = "Lorem, ipsum, dolor", sSize = Size 19}"slistO(n * m)/. Transposes the rows and columns of the slist.transpose $ slist [slist [1,2]]iSlist {sList = [Slist {sList = [1], sSize = Size 1},Slist {sList = [2], sSize = Size 1}], sSize = Size 2} >> 0transpose $ slist [slist [1,2,3], slist [4,5,6]]Ň Slist { sList = [ Slist {sList = [1,4], sSize = Size 2} , Slist {sList = [2,5], sSize = Size 2} , Slist {sList = [3,6], sSize = Size 2} ] , sSize = Size 3 } TIf some of the rows are shorter than the following rows, their elements are skipped:5transpose $ slist [slist [10,11], slist [20], mempty]nSlist {sList = [Slist {sList = [10,20], sSize = Size 2},Slist {sList = [11], sSize = Size 1}], sSize = Size 2}[If some of the rows is an infinite slist, then the resulting slist is going to be infinite.#slistO(2 ^ n)7. Returns the list of all subsequences of the argument.subsequences memptyDSlist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}subsequences $ slist "ab"ąSlist {sList = [Slist {sList = "", sSize = Size 0},Slist {sList = "a", sSize = Size 1},Slist {sList = "b", sSize = Size 1},Slist {sList = "ab", sSize = Size 2}], sSize = Size 4}+take 4 $ subsequences $ infiniteSlist [1..]˛Slist {sList = [Slist {sList = [], sSize = Size 0},Slist {sList = [1], sSize = Size 1},Slist {sList = [2], sSize = Size 1},Slist {sList = [1,2], sSize = Size 2}], sSize = Size 4}$slistO(n!)7. Returns the list of all permutations of the argument.permutations memptyDSlist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}permutations $ slist "abc"˙Slist {sList = [Slist {sList = "abc", sSize = Size 3},Slist {sList = "bac", sSize = Size 3},Slist {sList = "cba", sSize = Size 3},Slist {sList = "bca", sSize = Size 3},Slist {sList = "cab", sSize = Size 3},Slist {sList = "acb", sSize = Size 3}], sSize = Size 6}%slist O(\sum n_i) @ The concatenation of all the elements of a container of slists.1concat [slist [1,2], slist [3..5], slist [6..10]]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10} >>  concat $ slist [slist [1,2],   [3..]] Slist {sList = [1..], sSize = } &slist[Maps a function over all the elements of a container and concatenates the resulting slists.concatMap one "abc"%Slist {sList = "abc", sSize = Size 3}'slistO(n) . Similar to uA, but returns a slist of successive reduced values from the left: Nscanl f z $ slist [x1, x2, ...] == slist [z, z `f` x1, (z `f` x1) `f` x2, ...] Note that $last (scanl f z xs) == foldl f z xs.cThis peculiar arrangement is necessary to prevent scanl being rewritten in its own right-hand side.scanl (+) 0 $ slist [1..10]?Slist {sList = [0,1,3,6,10,15,21,28,36,45,55], sSize = Size 11}(slistO(n)%. A strictly accumulating version of ')slistO(n). ) is a variant of '% that has no starting value argument: <scanl1 f $ slist [x1, x2, ...] == slist [x1, x1 `f` x2, ...]*slistO(n). The right-to-left dual of '. Note that $head (scanr f z xs) == foldr f z xs.scanr (+) 0 $ slist [1..10]BSlist {sList = [55,54,52,49,45,40,34,27,19,10,0], sSize = Size 11}+slist A variant of *% that has no starting value argument.,slistO(n). A `dual' to v: while v$ reduces a list to a summary value, ,N builds a list from a seed value. The function takes the element and returns t- if it is done producing the list or returns w (a,b), in which case, a is a prepended to the list and b1 is used as the next element in a recursive call.In some cases, , can undo a v operation: unfoldr f' (foldr f z xs) == xsif the following holds: ,f' (f x y) = Just (x,y) f' z = NothingA simple use of unfoldr:<unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 107Slist {sList = [10,9,8,7,6,5,4,3,2,1], sSize = Size 10}-slist O(i) | i < n and O(1) | otherwise.BReturns the prefix of the slist of the given length. If the given i: is non-positive then the empty structure is returned. If iF is exceeds the length of the structure the initial slist is returned.take 5 $ slist "Hello world!"'Slist {sList = "Hello", sSize = Size 5}take 20 $ slist "small"'Slist {sList = "small", sSize = Size 5}take 0 $ slist "none""Slist {sList = "", sSize = Size 0}take (-11) $ slist "hmm""Slist {sList = "", sSize = Size 0}take 4 $ infiniteSlist [1..])Slist {sList = [1,2,3,4], sSize = Size 4}.slist O(i) | i < n and O(1) | otherwise.0Returns the suffix of the slist after the first i elements. If iJ exceeds the length of the slist then the empty structure is returned. If i3 is non-positive the initial structure is returned.drop 6 $ slist "Hello World"'Slist {sList = "World", sSize = Size 5}drop 42 $ slist "oops!""Slist {sList = "", sSize = Size 0}drop 0 $ slist "Hello World!"/Slist {sList = "Hello World!", sSize = Size 12}drop (-4) $ one 42$Slist {sList = [42], sSize = Size 1} >>  drop 5 $   [1..] Slist {sList = [6..], sSize = } /slist O(i) | i < n and O(1) | otherwise.Returns a tuple where the first element is the prefix of the given length and the second element is the remainder of the slist. splitAt 5 $ slist "Hello World!"S(Slist {sList = "Hello", sSize = Size 5},Slist {sList = " World!", sSize = Size 7})splitAt 0 $ slist "abc"J(Slist {sList = "", sSize = Size 0},Slist {sList = "abc", sSize = Size 3})splitAt 4 $ slist "abc"J(Slist {sList = "abc", sSize = Size 3},Slist {sList = "", sSize = Size 0})splitAt (-42) $ slist "??"I(Slist {sList = "", sSize = Size 0},Slist {sList = "??", sSize = Size 2}) >>  splitAt 2 $   [1..] (Slist {sList = [1,2], sSize = # 2}, Slist {sList = [3..], sSize = }) 0slistO(n)[. Returns the longest prefix (possibly empty) of elements that satisfy the given predicate.takeWhile (<3) $ slist [1..10]%Slist {sList = [1,2], sSize = Size 2}$takeWhile (<3) $ infiniteSlist [1..]%Slist {sList = [1,2], sSize = Size 2} takeWhile (<=10) $ slist [1..10]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10}takeWhile (<0) $ slist [1..10]"Slist {sList = [], sSize = Size 0}1slistO(n)y. Returns the suffix (possibly empty) of the remaining elements after dropping elements that satisfy the given predicate.dropWhile (<3) $ slist [1..10]2Slist {sList = [3,4,5,6,7,8,9,10], sSize = Size 8} dropWhile (<=10) $ slist [1..10]"Slist {sList = [], sSize = Size 0}dropWhile (<0) $ slist [1..10]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10}-take 5 $ dropWhile (<3) $ infiniteSlist [1..]+Slist {sList = [3,4,5,6,7], sSize = Size 5}2slistO(n)ł. Returns a tuple where first element is longest prefix (possibly empty) of the slist of elements that satisfy the given predicate and second element is the remainder of the list.#span (<3) $ slist [1,2,3,4,1,2,3,4]U(Slist {sList = [1,2], sSize = Size 2},Slist {sList = [3,4,1,2,3,4], sSize = Size 6})span (<=10) $ slist [1..3]L(Slist {sList = [1,2,3], sSize = Size 3},Slist {sList = [], sSize = Size 0})span (<0) $ slist [1..3]L(Slist {sList = [], sSize = Size 0},Slist {sList = [1,2,3], sSize = Size 3}) >>  span (<3) $   [1..]G (Slist {sList = [1,2], sSize = Size 2}, Slist {sList = [3..], sSize = }) 3slistO(n)h. Returns a tuple where first element is longest prefix (possibly empty) of the slist of elements that do notM satisfy the given predicate and second element is the remainder of the list.  > break p = 2 (x . p) 4slistO(m)1. Drops the given prefix from a list. It returns t6 if the slist did not start with the given prefix, or w( the slist after the prefix, if it does.*stripPrefix (slist "foo") (slist "foobar"),Just (Slist {sList = "bar", sSize = Size 3})'stripPrefix (slist "foo") (slist "foo"))Just (Slist {sList = "", sSize = Size 0})*stripPrefix (slist "foo") (slist "barfoo")Nothing!stripPrefix mempty (slist "foo"),Just (Slist {sList = "foo", sSize = Size 3})7stripPrefix (infiniteSlist [0..]) (infiniteSlist [1..])NothingNote:1 this function could hang on the infinite slists. >> 7stripPrefix (infiniteSlist [1..]) (infiniteSlist [1..]) <hangs> Use 5 instead.5slist Similar to 40, but never hangs on infinite lists and returns t in that case.;safeStripPrefix (infiniteSlist [1..]) (infiniteSlist [1..])Nothing;safeStripPrefix (infiniteSlist [0..]) (infiniteSlist [1..])Nothing6slistO(n)´. Takes a slist and returns a slist of slists such that the concatenation of the result is equal to the argument. Moreover, each sublist in the result contains only equal elements.It is a special case of 71, which allows to supply their own equality test.group $ slist "Mississippi"˙DSlist {sList = [Slist {sList = "M", sSize = Size 1},Slist {sList = "i", sSize = Size 1},Slist {sList = "ss", sSize = Size 2},Slist {sList = "i", sSize = Size 1},Slist {sList = "ss", sSize = Size 2},Slist {sList = "i", sSize = Size 1},Slist {sList = "pp", sSize = Size 2},Slist {sList = "i", sSize = Size 1}], sSize = Size 8} group mempty"Slist {sList = [], sSize = Size 0}7slistO(n) . Non-overloaded version of the 6 function.!groupBy (>) $ slist "Mississippi"ţSlist {sList = [Slist {sList = "M", sSize = Size 1},Slist {sList = "i", sSize = Size 1},Slist {sList = "s", sSize = Size 1},Slist {sList = "si", sSize = Size 2},Slist {sList = "s", sSize = Size 1},Slist {sList = "sippi", sSize = Size 5}], sSize = Size 6}8slistO(n)?. Returns all initial segments of the argument, shortest first.inits $ slist "abc"łSlist {sList = [Slist {sList = "", sSize = Size 0},Slist {sList = "a", sSize = Size 1},Slist {sList = "ab", sSize = Size 2},Slist {sList = "abc", sSize = Size 3}], sSize = Size 4} inits memptyDSlist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}9slistO(n)=. Returns all final segments of the argument, shortest first.tails $ slist "abc"łSlist {sList = [Slist {sList = "abc", sSize = Size 3},Slist {sList = "bc", sSize = Size 2},Slist {sList = "c", sSize = Size 1},Slist {sList = "", sSize = Size 0}], sSize = Size 4} tails memptyDSlist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}:slistO(m). Takes two slists and returns y/ iff the first slist is a prefix of the second.1isPrefixOf (slist "Hello") (slist "Hello World!")True1isPrefixOf (slist "Hello World!") (slist "Hello")FalseisPrefixOf mempty (slist "hey")TrueNote:1 this function could hang on the infinite slists. >> 6isPrefixOf (infiniteSlist [1..]) (infiniteSlist [1..]) <hangs> Use ; instead.;slist Similar to :0, but never hangs on infinite lists and returns z in that case.:safeIsPrefixOf (infiniteSlist [1..]) (infiniteSlist [1..])False:safeIsPrefixOf (infiniteSlist [0..]) (infiniteSlist [1..])False<slistTakes two slists and returns y/ iff the first slist is a suffix of the second.2isSuffixOf (slist "World!") (slist "Hello World!")True1isSuffixOf (slist "Hello World!") (slist "Hello")FalseisSuffixOf mempty (slist "hey")TrueNote:5 this function hangs if the second slist is infinite. >>  isSuffixOf anything (infiniteSlist [1..]) <hangs> Use = instead.=slist Similar to <0, but never hangs on infinite lists and returns z in that case.2safeIsSuffixOf (slist [1,2]) (infiniteSlist [1..])False:safeIsSuffixOf (infiniteSlist [1..]) (infiniteSlist [1..])False>slistTakes two slists and returns yQ iff the first slist is contained, wholly and intact, anywhere within the second.-isInfixOf (slist "ll") (slist "Hello World!")True*isInfixOf (slist " Hello") (slist "Hello")False0isInfixOf (slist "Hello World!") (slist "Hello")FalseNote:1 this function could hang on the infinite slists. >> 6isPrefixOf (infiniteSlist [1..]) (infiniteSlist [1..]) <hangs> Use ? instead.?slist Similar to >0, but never hangs on infinite lists and returns z in that case.9safeIsInfixOf (infiniteSlist [1..]) (infiniteSlist [1..])False9safeIsInfixOf (infiniteSlist [0..]) (infiniteSlist [1..])False@slistTakes two slists and returns yx if all the elements of the first slist occur, in order, in the second. The elements do not have to occur consecutively.isSubsequenceOf x y is equivalent to { x (# y).4isSubsequenceOf (slist "Hll") (slist "Hello World!")True1isSubsequenceOf (slist "") (slist "Hello World!")True6isSubsequenceOf (slist "Hallo") (slist "Hello World!")FalseNote:5 this function hangs if the second slist is infinite. >>  isSuffixOf anything (infiniteSlist [1..]) <hangs> Use = instead.Aslist Similar to @0, but never hangs on infinite lists and returns z in that case.?safeIsSubsequenceOf (infiniteSlist [1..]) (infiniteSlist [1..])False?safeIsSubsequenceOf (infiniteSlist [0..]) (infiniteSlist [1..])FalseBslistO(n)<. Looks up by the given key in the slist of key-value pairs.,lookup 42 $ slist $ [(1, "one"), (2, "two")]NothingWlookup 42 $ slist $ [(1, "one"), (2, "two"), (42, "life, the universe and everything")](Just "life, the universe and everything";lookup 1 $ zip (infiniteSlist [1..]) (infiniteSlist [0..])Just 0CslistO(n)E. Returns the slist of the elements that satisfy the given predicate.filter (<3) $ slist [1..5]%Slist {sList = [1,2], sSize = Size 2})take 5 $ filter odd $ infiniteSlist [1..]+Slist {sList = [1,3,5,7,9], sSize = Size 5}DslistO(n)Y. Returns the pair of slists of elements which do and do not satisfy the given predicate.partition (<3) $ slist [1..5]O(Slist {sList = [1,2], sSize = Size 2},Slist {sList = [3,4,5], sSize = Size 3})Eslist O(i) | i < n and O(1) | otherwise.?Returns the element of the slist at the given position. If the i6 exceeds the length of the slist the function returns t.let sl = slist [1..10]at 0 slJust 1 at (-1) slNothingat 11 slNothingat 9 slJust 10Fslist O(min i n). Unsafe version of the Ec function. If the element on the given position does not exist it throws the exception at run-time.let sl = slist [1..10] unsafeAt 0 sl1unsafeAt (-1) sl)*** Exception: Prelude.!!: negative indexunsafeAt 11 sl**** Exception: Prelude.!!: index too large unsafeAt 9 sl10GslistO(n)O. Returns the index of the first element in the given slist which is equal (by |) to the query element, or t if there is no such element.elemIndex 5 $ slist [1..10]Just 4elemIndex 0 $ slist [1..10]NothingHslistO(n) . Extends GZ, by returning the indices of all elements equal to the query element, in ascending order.+elemIndices 1 $ slist [1,1,1,2,2,4,5,1,9,1]+Slist {sList = [0,1,2,7,9], sSize = Size 5}!take 5 $ elemIndices 1 $ repeat 1+Slist {sList = [0,1,2,3,4], sSize = Size 5}IslistO(n)Y. Returns the index of the first element in the slist satisfying the given predicate, or t if there is no such element.findIndex (>3) $ slist [1..5]Just 3findIndex (<0) $ slist [1..5]NothingJslistO(n) . Extends I^, by returning the indices of all elements satisfying the given predicate, in ascending order.findIndices (<3) $ slist [1..5]%Slist {sList = [0,1], sSize = Size 2}findIndices (<0) $ slist [1..5]"Slist {sList = [], sSize = Size 0}1take 5 $ findIndices (<=10) $ infiniteSlist [1..]+Slist {sList = [0,1,2,3,4], sSize = Size 5}Kslist O(min n m)>. Takes two slists and returns a slist of corresponding pairs.(zip (slist [1,2]) (slist ["one", "two"])5Slist {sList = [(1,"one"),(2,"two")], sSize = Size 2}*zip (slist [1,2,3]) (slist ["one", "two"])5Slist {sList = [(1,"one"),(2,"two")], sSize = Size 2}1zip (slist [1,2]) (slist ["one", "two", "three"])5Slist {sList = [(1,"one"),(2,"two")], sSize = Size 2}zip mempty (slist [1..5])"Slist {sList = [], sSize = Size 0}0zip (infiniteSlist [1..]) (slist ["one", "two"])5Slist {sList = [(1,"one"),(2,"two")], sSize = Size 2}LslistO(minimum [n1, n2, n3])B. Takes three slists and returns a slist of triples, analogous to K.Mslist O(min n m). Generalises KC by zipping with the given function, instead of a tupling function. For example,  zipWith (+)C is applied to two lists to produce the list of corresponding sums.NslistO(minimum [n1, n2, n3])Œ. Takes a function which combines three elements, as well as three slists and returns a slist of their point-wise combination, analogous to M.OslistO(n)`. Transforms a slist of pairs into a slist of first components and a slist of second components.#unzip $ slist [(1,"one"),(2,"two")]U(Slist {sList = [1,2], sSize = Size 2},Slist {sList = ["one","two"], sSize = Size 2})PslistO(n)B. Takes a slist of triples and returns three slists, analogous to O.QslistO(n^2)m. Removes duplicate elements from a slist. In particular, it keeps only the first occurrence of each element.It is a special case of R0, which allows to supply your own equality test.nub $ replicate 5 'a'#Slist {sList = "a", sSize = Size 1} nub mempty"Slist {sList = [], sSize = Size 0}#nub $ slist [1,2,3,4,3,2,1,2,4,3,5]+Slist {sList = [1,2,3,4,5], sSize = Size 5}RslistO(n^2). Behaves just like QN, except it uses a user-supplied equality predicate instead of the overloaded | function.6nubBy (\x y -> mod x 3 == mod y 3) $ slist [1,2,4,5,6]'Slist {sList = [1,2,6], sSize = Size 3}SslistO(n)L. Removes the first occurrence of the given element from its slist argument.delete 'h' $ slist "hahaha"'Slist {sList = "ahaha", sSize = Size 5}delete 0 $ slist [1..3]'Slist {sList = [1,2,3], sSize = Size 3}TslistO(n). Behaves like S/, but takes a user-supplied equality predicate.deleteBy (>=) 4 $ slist [1..10]4Slist {sList = [2,3,4,5,6,7,8,9,10], sSize = Size 9}UslistO(n*m)…. Takes a predicate and two slists and returns the first slist with the first occurrence of each element of the second slist removed.7deleteFirstsBy (==) (slist [1..5]) (slist [2,8,4,10,1])%Slist {sList = [3,5], sSize = Size 2}VslistO(n*m)`. Returns the difference between two slists. The operation is non-associative. In the result of  diff xs ys*, the first occurrence of each element of ys( in turn (if any) has been removed from xs. Thus diff (xs <> ys) ys == xs&diff (slist [1..10]) (slist [1,3..10]),Slist {sList = [2,4,6,8,10], sSize = Size 5}(diff (slist [1,3..10]) (slist [2,4..10])+Slist {sList = [1,3,5,7,9], sSize = Size 5}WslistO(n*m)+. Returns the list union of the two slists.#union (slist "pen") (slist "apple")'Slist {sList = "penal", sSize = Size 5}“Duplicates, and elements of the first slist, are removed from the the second slist, but if the first slist contains duplicates, so will the result.#union (slist "apple") (slist "pen")(Slist {sList = "applen", sSize = Size 6}It is a special case of X.XslistO(n*m). Non-overloaded version of W.YslistO(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}6If the first slist is infinite, so will be the result.nIf 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 Z.ZslistO(n*m). Non-overloaded version of Y.[slist O(n log n)A. implements a stable sorting algorithm. It is a special case of \.nElements are arranged from from lowest to highest, keeping duplicates in the order they appeared in the input.sort $ slist [10, 9..1]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10}Note:( this function hangs on infinite slists.\slist O(n log n). Non-overloaded version of [.SsortBy (\(a,_) (b,_) -> compare a b) $ slist [(2, "world"), (4, "!"), (1, "Hello")]ASlist {sList = [(1,"Hello"),(2,"world"),(4,"!")], sSize = Size 3}Note:( this function hangs on infinite slists.]slist O(n log n)T. Sorts a list by comparing the results of a key function applied to each element. sortOn f is equivalent to \ (comparing f)7, but has the performance advantage of only evaluating fz once for each element in the input list. This is called the decorate-sort-undecorate paradigm, or Schwartzian transform.iElements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.9sortOn fst $ slist [(2, "world"), (4, "!"), (1, "Hello")]ASlist {sList = [(1,"Hello"),(2,"world"),(4,"!")], sSize = Size 3}Note:( this function hangs on infinite slists.^slistO(n)ţ. Takes an element and a slist and inserts the element into the slist at the first position where it is less than or equal to the next element. In particular, if the list is sorted before the call, the result will also be sorted. It is a special case of _.insert 4 $ slist [1,2,3,5,6]-Slist {sList = [1,2,3,4,5,6], sSize = Size 6}_slistO(n) . The non-overloaded version of ^.bslistEfficient implementation of } and ~ functions.  returns qs m on infinite lists.hslistList appending. Use € for   concatenation instead of 9 operator that is common in ordinary list concatenations.islist(Lexicographical comparison of the lists.jslistEquality of sized lists is checked more efficiently due to the fact that the check on the list sizes can be done first for the constant time.W  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_W  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_‚      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopnqrnqsntuvwntntnxynz{nz|nx}u~uv€uvnz‚u~ƒnz„nz…nz†n‡ˆn‡‰Š"slist-0.0.0-1litXerYai24jDEfQhvVOo Slist.SizeSlistSizeInfinitysizes $fBoundedSize $fNumSize $fShowSize $fReadSize$fEqSize $fOrdSizeslist infiniteSlistoneiterateiterate'repeat replicatecyclelensizeisEmptyheadsafeHeadlastsafeLasttailinitunconsmapreverse safeReverse intersperse intercalate transpose subsequences permutationsconcat concatMapscanlscanl'scanl1scanrscanr1unfoldrtakedropsplitAt takeWhile dropWhilespanbreak stripPrefixsafeStripPrefixgroupgroupByinitstails isPrefixOfsafeIsPrefixOf isSuffixOfsafeIsSuffixOf isInfixOf safeIsInfixOfisSubsequenceOfsafeIsSubsequenceOflookupfilter partitionatunsafeAt elemIndex elemIndices findIndex findIndiceszipzip3zipWithzipWith3unzipunzip3nubnubBydeletedeleteBydeleteFirstsBydiffunionunionBy intersect intersectBysortsortBysortOninsertinsertBy $fIsListSlist$fTraversableSlist$fFoldableSlist $fMonadSlist$fAlternativeSlist$fApplicativeSlist$fFunctorSlist $fMonoidSlist$fSemigroupSlist $fOrdSlist $fEqSlist $fShowSlist $fReadSlistbaseGHC.EnummaxBoundGHC.Num+*GHC.Listghc-prim GHC.TypesInt GHC.MaybeNothing Data.FoldablefoldlfoldrJust GHC.ClassesnotTrueFalseelem==sumproductlengthGHC.Base<>++