Created
June 15, 2016 19:21
-
-
Save kflu/3d60c9c567f1f13f29276860135354e6 to your computer and use it in GitHub Desktop.
Some racket snippets
This file contains hidden or 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
#lang racket | |
(define (factorial x) | |
(cond | |
[(< x 0) (raise "Value can't be less than zero")] | |
[(= x 0) 1] | |
[(= x 1) 1] | |
[else (* x (factorial (- x 1)))])) | |
(factorial 99) | |
(factorial -1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment