Skip to content

Instantly share code, notes, and snippets.

@ashmoran
Forked from bishboria/sicp_exercise_2_23.scm
Created January 21, 2011 18:56
Show Gist options
  • Save ashmoran/790194 to your computer and use it in GitHub Desktop.
Save ashmoran/790194 to your computer and use it in GitHub Desktop.
(define (my-for-each proc values)
(if (null? values)
#t
(let ()
(proc (car values))
(my-for-each proc (cdr values)))))
(import srfi-1)
(use srfi-1)
(define (my-begin . statements)
(last statements))
(define (my-for-each proc list-of-values)
(if (null? list-of-values)
#t
(my-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