Created
May 21, 2015 01:34
-
-
Save andrewhr/82b77b80365be686ff83 to your computer and use it in GitHub Desktop.
#protip this is not the Clojure you're looking for...
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
(deftype Event (U :new-release)) | |
(defn probability :- Float | |
"Return the probability of some `Event` to occur. IRL this should be some | |
real and complicated calculus instead of a simply constant" | |
[event :- Event :> Float] | |
0.95) | |
(defn descriptive-propability | |
"Describe the probability of a given `Event` to occur, for human readers." | |
[event :- Event] :- String | |
(match (probability event) | |
1.00 "certain" | |
0.00 "impossible" | |
(range 0.00 0.25) "very unlikely" | |
(range 0.25 0.50) "unlikely" | |
(range 0.50 0.75) "likely" | |
(range 0.75 1.00) "very likely" | |
_ (unreachable!))) | |
(defn -main [] | |
(println! (descriptive-propability :new-release))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment