Module:Mediants: Difference between revisions
todo |
Add deepest_depth function |
||
| Line 2: | Line 2: | ||
-- TODO: | -- TODO: | ||
-- - Add a convert-to-rational function. | -- - Add a convert-to-rational function. | ||
-------------------------------------------------------------------------------- | |||
------------------------------ UTILITY FUNCTIONS ------------------------------- | |||
-------------------------------------------------------------------------------- | |||
-- Given a table of depths, return the deepest depth | |||
function p.deepest_depth(depths) | |||
local deepest = nil | |||
for _, value in ipairs(depths) do | |||
if not deepest or value > deepest then | |||
deepest = value | |||
end | |||
end | |||
return deepest | |||
end | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||