Skip to content

Instantly share code, notes, and snippets.

@kflu
Created June 15, 2016 19:21
Show Gist options
  • Save kflu/3d60c9c567f1f13f29276860135354e6 to your computer and use it in GitHub Desktop.
Save kflu/3d60c9c567f1f13f29276860135354e6 to your computer and use it in GitHub Desktop.
Some racket snippets
#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