Skip to content

Instantly share code, notes, and snippets.

@groz
Created September 4, 2016 16:41
Show Gist options
  • Save groz/8d2694b0f7f0b011f1fe37ed519aef62 to your computer and use it in GitHub Desktop.
Save groz/8d2694b0f7f0b011f1fe37ed519aef62 to your computer and use it in GitHub Desktop.
count change in mit-scheme
(define (count-change coins amount)
(display coins) (newline)
(display amount) (newline)
(cond
((= 0 amount) 1)
((< amount 0) 0)
((null? coins) 0)
(else
(+
(count-change coins (- amount (car coins)))
(count-change (cdr coins) amount)
)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment