From e91d37e8bc72eeb57cd0a2b1458e81776d9c018d Mon Sep 17 00:00:00 2001 From: Inga Date: Mon, 4 Dec 2023 12:14:10 +0000 Subject: [PATCH] more simplification --- day01-easy/main.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/day01-easy/main.scm b/day01-easy/main.scm index da2a592..aa45494 100755 --- a/day01-easy/main.scm +++ b/day01-easy/main.scm @@ -22,9 +22,9 @@ (lambda (current accumulator) (cons (mapper current) accumulator)) '())) -(define compose (reduce-right - (lambda (current accumulator) (lambda (value) (current (accumulator value)))) - id)) +(define (compose-two f g) (lambda (x) (f (g x)))) + +(define compose (reduce-right compose-two id)) (define (combine combiner) (lambda (a b) (if (null? a) b (if (null? b) a (combiner a b)))))