Created
March 9, 2012 04:09
-
-
Save dasch/2004981 to your computer and use it in GitHub Desktop.
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
def calculate_score(term) | |
if score can be calculated | |
Score.new(value) | |
else | |
NoScore | |
end | |
end | |
def save_score(term, score) | |
if score.available? | |
value = score.value | |
save the value | |
else | |
save a NULL | |
end | |
end |
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
val calculateScore : string -> real option | |
val saveScore : (string, real option) -> unit | |
fun calculateScore term = if something then SOME score else NONE | |
fun saveScore (term, SOME score) = save that score! | |
| saveScore (term, NONE) = don't save it, or save nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment