Created
September 11, 2013 16:57
-
-
Save claj/6526542 to your computer and use it in GitHub Desktop.
Some rules I've found useful in Kibit.
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
;;trivial identites | |
[(+ ?x 0) ?x] | |
[(- ?x 0) ?x] | |
[(* ?x 1) ?x] | |
[(/ ?x 1) ?x] | |
[(* ?x 0) 0] | |
;;Math/pow | |
[(* ?x ?x) (Math/pow ?x 2) ] | |
[(* ?x ?x ?x) (Math/pow ?x 3) ] | |
[(* ?x ?x ?x ?x) (Math/pow ?x 4) ] | |
[(* ?x ?x ?x ?x ?x) (Math/pow ?x 5) ] | |
;;Math/hypot | |
[(Math/sqrt (+ (Math/pow ?x 2) (Math/pow ?y 2))) (Math/hypot ?x ?y)] | |
;;Math/expm1 | |
[(dec (Math/exp ?x)) (Math/expm1 ?x)] | |
;;ugly rounding tricks | |
[(long (+ ?x 0.5)) (Math/round ?x)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment