Skip to content

Instantly share code, notes, and snippets.

@ourmaninamsterdam
Created June 21, 2020 17:29
Show Gist options
  • Save ourmaninamsterdam/6af06bf3e0c50da96795b41b3b26979f to your computer and use it in GitHub Desktop.
Save ourmaninamsterdam/6af06bf3e0c50da96795b41b3b26979f to your computer and use it in GitHub Desktop.
Simple factorial fn in Racket
(check-expect (fact 0) 1)
(check-expect (fact 3) 6)
(define (fact n)
(cond [(zero? n) 1]
[else
(* n
(fact (sub1 n)))]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment