Add a generator for the sorted substitution table.
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-10-22 17:26:54 +03:00
parent 126a706292
commit 79ae13aa5a
2 changed files with 14 additions and 0 deletions
@@ -17,6 +17,13 @@
(shuffled-numbers)
(zipmap symbols)))
(defn generate-sorted-substitution-table
"Generate the map (char, int) for the substittion. BUT a value is the index of a symbol (from 0)."
[symbols]
(-> (count symbols)
(take (range))
(zipmap symbols)))
(defn find-value-in-table
"It uses the substitution table to find the value of a char or a number."
[char substitution-table]