Skip to content

Instantly share code, notes, and snippets.

@dleslie
Created April 24, 2012 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dleslie/2475945 to your computer and use it in GitHub Desktop.
Save dleslie/2475945 to your computer and use it in GitHub Desktop.
Maybe example
(do <maybe>
(if #t
'Nothing
'(Just First))
'(Just Second))
; Returns: Nothing
((do <state>
(x <- (/m! gets (lambda (s) (+ s 1))))
(return x))
1)
; Returns: (2 . 1)
((do <reader>
(/m! local
(lambda (v) (+ v 1))
(do <reader>
(x <- (/m ask))
(return x))))
1)
; Returns: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment