From 92c70970f5b08cbaab42dca4063614f4fd5a35c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20M=C3=BCller=20Madsen?= Date: Sat, 8 Apr 2017 20:44:27 +0200 Subject: [PATCH] add support for scaling recipes by numerical factors --- parse.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parse.scm b/parse.scm index 0489244..6bfbf68 100644 --- a/parse.scm +++ b/parse.scm @@ -105,7 +105,12 @@ [new-steps steps] [new-servings wanted-servings]) (make-recipe new-name new-servings new-ingredients new-steps) - )))) + )))) + +(define scale-recipe-by-factor + (lambda (recipe scale-factor) + (let ([new-servings (* (recipe-servings recipe) scale-factor)]) + (scale-recipe recipe new-servings)))) ;; Constructors