Skip to content

Commit

Permalink
Added the force-safely function.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsorokin committed Jun 20, 2015
1 parent acdf044 commit b5f75bd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion trivial-lazy.lisp
Expand Up @@ -9,7 +9,8 @@
(:export #:memo
#:*memo-thread-safe*
#:delay
#:force))
#:force
#:force-safely))

(in-package :trivial-lazy)

Expand Down Expand Up @@ -49,3 +50,9 @@
(defun force (delayed-exp)
"Force to return the value of the delayed expression."
(funcall delayed-exp))

(defun force-safely (delayed-exp?)
"Force safely to return the value of the delayed expression."
(if (functionp delayed-exp?)
(funcall delayed-exp?)
delayed-exp?))

0 comments on commit b5f75bd

Please sign in to comment.