Skip to content

Instantly share code, notes, and snippets.

@Slackwise
Last active March 16, 2018 11:42
Show Gist options
  • Save Slackwise/5da78ed94b5c837e224e6182726e6f67 to your computer and use it in GitHub Desktop.
Save Slackwise/5da78ed94b5c837e224e6182726e6f67 to your computer and use it in GitHub Desktop.
Reduce in Scheme: my favorite function ever, written as reduced as possible, using only special forms.
(define (reduce f i l)
(if (null? l)
i
(f i (reduce f (car l) (cdr l)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment