diff --git a/parse.scm b/parse.scm index 55922ad..54cea99 100644 --- a/parse.scm +++ b/parse.scm @@ -63,19 +63,5 @@ (define recipes-by-ingredients (lambda (recipes search-ingredients) - (recipes-by-ingredients-rec recipes search-ingredients '()))) - -(define recipes-by-ingredients-rec - (lambda (recipes search-ingredients list) - (if (null? recipes) - list - (let* ((recipe (car recipes)) - (ingredients (ingredients recipe)) - (contains? (contains-ingredients? recipe - search-ingredients)) - (new-list (if contains? - (cons recipe list) - list))) - (recipes-by-ingredients-rec (cdr recipes) - search-ingredients - new-list))))) + (filter (lambda (x) (contains-ingredients? x search-ingredients)) + recipes)))