From 2602e1d3de22a86aafab7bc7bf0db90c524ed371 Mon Sep 17 00:00:00 2001 From: Luis Guilherme Coelho Date: Mon, 19 Feb 2024 21:41:35 -0300 Subject: [PATCH] combinators: Fix any-of and juxt --- modules/radix/combinators.scm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/radix/combinators.scm b/modules/radix/combinators.scm index a03630f..a8e07bd 100644 --- a/modules/radix/combinators.scm +++ b/modules/radix/combinators.scm @@ -18,11 +18,13 @@ element of LST satisfies PRED." (define (any-of pred) "Returns a procedure that takes a list LST and returns #t if any element of LST satisfies PRED." - (match-lambda - (() #f) - ((head . tail) - (cond ((pred head) #t) - (else (any? pred tail)))))) + (lambda (lst) + (let loop ((lst lst)) + (match + ('() #f) + ((head . tail) + (cond ((pred head) #t) + (else (loop tail)))))))) (define (conjoin . predicates) "Returns a procedure that is the conjuction of every predicate in PREDICATES. @@ -77,5 +79,6 @@ of aditional arguments." "Returns a procedure that is the juxtaposition of it's argument procedures. The returned procedure takes a variable number of args, and returns a list containing the result of applying each procedure to the args (left-to-right)." - (map (partial (flip apply) args) - (cons proc more-procs))) + (lambda args + (map (partial (flip apply) args) + (cons proc more-procs))))