Skip to content

Instantly share code, notes, and snippets.

@dasch
Created March 9, 2012 04:09
Show Gist options
  • Save dasch/2004981 to your computer and use it in GitHub Desktop.
Save dasch/2004981 to your computer and use it in GitHub Desktop.
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
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