combinators: Correct procedure definitions

pull/1/head
Luis Guilherme Coelho 2024-01-03 00:43:04 -03:00
parent 1d0ecb3955
commit a365ad9734
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
1 changed files with 2 additions and 2 deletions

View File

@ -66,14 +66,14 @@ obtained by appending ARGS to MORE-ARGS."
"Returns a procedure that applies PROC to the reverse of ARGS." "Returns a procedure that applies PROC to the reverse of ARGS."
(lambda args (apply proc (reverse args)))) (lambda args (apply proc (reverse args))))
(define ((swap proc) arg1 arg2 . more-args) (define (swap proc)
"Returns a procedure that takes ARG1, ARG2 and optionally more args, and "Returns a procedure that takes ARG1, ARG2 and optionally more args, and
applies PROC to the list obtained by cons*ing ARG2 ARG1 to ARG2 to the list applies PROC to the list obtained by cons*ing ARG2 ARG1 to ARG2 to the list
of aditional arguments." of aditional arguments."
(lambda (arg1 arg2 . args) (lambda (arg1 arg2 . args)
(apply proc arg2 arg1 args))) (apply proc arg2 arg1 args)))
(define ((juxt proc . more-procs) . args) (define (juxt proc . more-procs)
"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)."