Module:Mediants: Difference between revisions

Ganaram inukshuk (talk | contribs)
No edit summary
Ganaram inukshuk (talk | contribs)
Added ratios that formed the mediant to mediant data, for search functions that need that information
Line 22: Line 22:
-- A search function has two params: a table containing the mediant and the
-- A search function has two params: a table containing the mediant and the
-- depth it was found at, and a search param.
-- depth it was found at, and a search param.
-- Mediant data, the first param, is of the form:
-- Mediant data is a table that contains the mediant, the search depth it was
-- { ["mediant"] = { p, q }, ["depth"] = d }, where, p, q, d are integers.
-- found at, and the two ratios that were used to find the mediant.
-- The search params can be a single numeric value, or a table of values for
-- The search params can be a single numeric value, or a table of values for
-- finer control.
-- finer control.
Line 79: Line 79:
table.insert(new_depths, depth_1)
table.insert(new_depths, depth_1)
local mediant_data = { ["mediant"] = mediant, ["depth"] = new_depth }
local mediant_data = { ["mediant"] = mediant, ["depth"] = new_depth, ["ratio_1"] = ratio_1, ["ratio_2"] = ratio_2 }
if search_func(mediant_data, search_args) then
if search_func(mediant_data, search_args) then
table.insert(new_ratios, mediant)
table.insert(new_ratios, mediant)