-
-
Save bishboria/790087 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
(define (my-for-each proc list-of-values) | |
(cond ((null? list-of-values) #t) | |
(else (proc (car list-of-values)) | |
(my-for-each proc (cdr list-of-values))))) | |
;; or | |
(define (my-for-each proc list-of-values) | |
(if (null? list-of-values) | |
#t | |
(begin | |
(proc (car list-of-values)) | |
(my-for-each proc (cdr list-of-values))))) | |
(my-for-each (lambda (x) (display x) (newline)) (list 1 3 999 3.14)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure which I prefer actually
I hadn't seen
begin
before, but it's clearly an easy function to implement yourself! -> https://gist.github.com/790194