procedure satin_tieup(counter, shafts, treadles) local rows, m, k rows := list(shafts, repl("0", treadles)) m := 1 rows[1, 1] := "1" every k := 2 to shafts do rows[k, residue(m +:= counter, shafts, 1)] := "1" return rows end