combinators: Fix proc signatures

main
Luis Guilherme Coelho 2024-08-26 18:43:44 -03:00
parent 91a1713d6d
commit dda033a2d9
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
1 changed files with 6 additions and 6 deletions

View File

@ -27,7 +27,7 @@ LST satisfies PRED."
(cond ((pred head) #t) (cond ((pred head) #t)
(else (loop tail))))))) (else (loop tail)))))))
(define* ((conjoin . predicates) args) (define* ((conjoin . predicates) . args)
"Returns a procedure that is the conjuction of every predicate in PREDICATES. "Returns a procedure that is the conjuction of every predicate in PREDICATES.
The returned procedure takes an arbitrary number of arguments, and returns #t The returned procedure takes an arbitrary number of arguments, and returns #t
if these arguments satisfy every other predicate in PREDICATES." if these arguments satisfy every other predicate in PREDICATES."
@ -37,7 +37,7 @@ if these arguments satisfy every other predicate in PREDICATES."
((apply head-pred args) (loop tail-preds)) ((apply head-pred args) (loop tail-preds))
(else #f))))) (else #f)))))
(define* ((disjoin . predicates) args) (define* ((disjoin . predicates) . args)
"Returns a procedure that is the disjunction of every predicate in PREDICATES. "Returns a procedure that is the disjunction of every predicate in PREDICATES.
The returned procedure takes an arbitrary number of arguments, and returns #t if The returned procedure takes an arbitrary number of arguments, and returns #t if
these arguments satisfy exactly one predicate in PREDICATES, and #f otherwise." these arguments satisfy exactly one predicate in PREDICATES, and #f otherwise."
@ -46,7 +46,7 @@ The returned procedure takes an arbitrary number of arguments, and returns #t if
((_) #t) ((_) #t)
(else #f)))) (else #f))))
(define* ((inclusive-disjoin . predicates) args) (define* ((inclusive-disjoin . predicates) . args)
"Returns a procedure that is the inclusive disjunction of every predicate in "Returns a procedure that is the inclusive disjunction of every predicate in
PREDICATES. The returned procedure takes an arbitrary number of arguments, and PREDICATES. The returned procedure takes an arbitrary number of arguments, and
returns #t if these arguments satifsy at least one predicate in PREDICATES, and returns #t if these arguments satifsy at least one predicate in PREDICATES, and
@ -57,12 +57,12 @@ returns #t if these arguments satifsy at least one predicate in PREDICATES, and
((not (apply head-pred args)) (loop tail-preds)) ((not (apply head-pred args)) (loop tail-preds))
(else #f))))) (else #f)))))
(define* ((partial proc . args) more-args) (define* ((partial proc . args) . more-args)
"Returns a procedure that receives MORE-ARGS applies PROC to the list "Returns a procedure that receives MORE-ARGS applies PROC to the list
obtained by appending ARGS to MORE-ARGS." obtained by appending ARGS to MORE-ARGS."
(apply proc (append args more-args))) (apply proc (append args more-args)))
(define* ((flip proc) args) (define* ((flip proc) . args)
"Returns a procedure that applies PROC to the reverse of ARGS." "Returns a procedure that applies PROC to the reverse of ARGS."
(apply proc (reverse args))) (apply proc (reverse args)))
@ -72,7 +72,7 @@ applies PROC to the list obtained by cons*ing ARG2 ARG1 to ARG2 to the list
of aditional arguments." of aditional arguments."
(apply proc arg2 arg1 args)) (apply proc arg2 arg1 args))
(define* ((juxt proc . more-procs) args) (define* ((juxt proc . more-procs) . args)
"Returns a procedure that is the juxtaposition of it's argument procedures. "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 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)." containing the result of applying each procedure to the args (left-to-right)."