Created
September 13, 2016 23:54
-
-
Save noisesmith/bf55a69b223a6762df4f30cf4a675daf to your computer and use it in GitHub Desktop.
default method on LazyDelay protocol
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
| kingfisher.core=> (defprotocol LazyDelay (default [this x])) | |
| LazyDelay | |
| kingfisher.core=> (extend-protocol LazyDelay clojure.lang.Delay (default [this x] (if (realized? this) @this x))) | |
| nil | |
| kingfisher.core=> (def d (delay 42)) | |
| #'kingfisher.core/d | |
| kingfisher.core=> (default d 12) | |
| 12 | |
| kingfisher.core=> @d | |
| 42 | |
| kingfisher.core=> (default d 12) | |
| 42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment