-- Penlight 1.11.0-1 | /lua/pl/seq.lua | https://github.com/lunarmodules/Penlight | License: MIT | Minified using https://www.npmjs.com/package/luamin/v/1.0.4 -- Copyright (C) 2009-2016 Steve Donovan, David Manura. -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. local next,assert,pairs,tonumber,type,setmetatable=next,assert,pairs,tonumber,type,setmetatable;local a,b=string.find,string.format;local c=math.random;local d,e=table.sort,table.insert;local io=io;local f=require'pl.utils'local g=require'pl.types'.is_callable;local h=f.function_arg;local i=f.assert_arg;local j=require'debug'local k={}function k.greater_than(l)return function(m)return tonumber(m)>l end end;function k.less_than(l)return function(m)return tonumber(m)w then return nil else return x end end end;function k.count(u,y,z)local x=0;k.foreach(u,function(A)if y(A,z)then x=x+1 end end)return x end;function k.minmax(u)local B,C=1e70,-1e70;for m in t(u)do m=tonumber(m)if mC then C=m end end;return B,C end;function k.sum(u,D)local n=0;local x=0;for m in t(u)do if D then m=D(m)end;n=n+m;x=x+1 end;return n,x end;function k.copy(u)local E,F={},1;for m in t(u)do E[F]=m;F=F+1 end;setmetatable(E,require('pl.List'))return E end;function k.copy2(u,G,H)local E,F={},1;for I,J in u,G,H do E[F]={I,J}F=F+1 end;return E end;function k.copy_tuples(u)u=t(u)local E={}local K={u()}while#K>0 do e(E,K)K={u()}end;return E end;function k.random(L,M,N)local O;assert(type(L)=='number')if N then O=function()return c(M,N)end elseif M then O=function()return c(M)end else O=c end;return function()if L==0 then return nil else L=L-1;return O()end end end;function k.sort(u,P)local p=k.copy(u)d(p,P)return s(p)end;function k.zip(Q,R)Q=t(Q)R=t(R)return function()return Q(),R()end end;function k.count_map(u)local p={}local m;for n in t(u)do m=p[n]if m then p[n]=m+1 else p[n]=1 end end;return setmetatable(p,require('pl.Map'))end;function k.unique(u,S)local p=k.count_map(u)local E,F={},1;for q in pairs(p)do E[F]=q;F=F+1 end;table.sort(E)if S then return E else return s(E)end end;function k.printall(u,T,U,V)local W=io.write;if not T then T=' 'end;if not U then if T=='\n'then U=1e30 else U=7 end end;if V then local X=V;V=function(m)return b(X,m)end end;local F=1;for m in t(u)do if V then m=V(m)end;if F