blob: 8fedbf712c711442d650add6c5d2a9348a7d3256 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
--- lam.util
local m = {}
function m.pop (tbl)
--[[ Remove the first element from TBL. ]]
return table.remove(tbl, 1)
end
function m.assert_arity (r, min, max)
local rmin = min or 0
local rmax = max or 1/0 -- infinity
local rlen = #r
if rlen < rmin or rlen > rmax then
error(string.format("Wrong arity: %s; expecting %s",
rlen,
rmin == rmax and rmin or (rmin..".."..rmax)))
end
end
---
return m
|