Last active
December 24, 2021 08:02
-
-
Save ytaki0801/4ce2f5390e265b0bb11970a19f3ee7df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; referense | |
;;;; SLIB 3b1-5 | |
;;;; Gauche 0.9.11 | |
;;;; MIT/GNU Scheme 11.2 | |
(define (reduce-right f ridentity ls) | |
(if (null? ls) ridentity | |
(let loop ((ridentity (car ls)) (ls (cdr ls))) | |
(if (null? ls) ridentity | |
(f ridentity (loop (car ls) (cdr ls))))))) | |
;;;; Guile 3.0.7 | |
(define (reduce-right f ridentity ls) | |
(if (null? ls) ridentity | |
(fold-right f (last ls) (drop-right ls 1)))) | |
;;;; Chibi-Scheme 0.10.0 | |
(define (reduce-right f ridentity ls) | |
(if (null? ls) ridentity | |
(fold-right f ridentity ls))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment