Common fns required across brew-bot
Common fns required across brew-bot
(join-ingredient-maps ingredient-bill ingredient-source added-key)
Given an ingredient map, lookup the source ingredient and combine it with the added-key
Given an ingredient map, lookup the source ingredient and combine it with the added-key
(max-n-kv m n)
Given m
with k-v pairs for which all values are numbers, return the n
k-v pairs with the highest values
Given `m` with k-v pairs for which all values are numbers, return the `n` k-v pairs with the highest values
(min-n-kv m n)
Given m
with k-v pairs for which all values are numbers, return the n
k-v pairs with the lowest values
Given `m` with k-v pairs for which all values are numbers, return the `n` k-v pairs with the lowest values
(rand-key m)
Pick a random key from a map, weighted by the :probability key of the value
Pick a random key from a map, weighted by the :probability key of the value
(scale-ingredients ingredient-map weight-limit)
Update ingredient-map
so the combined :weights are randomly scaled up to weight-limit
Update `ingredient-map` so the combined :weights are randomly scaled up to `weight-limit`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close