diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-10-30 21:50:32 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-10-30 21:50:32 -0700 |
commit | d38e9a82b7bdff9f990ff5c5650366890f16cfe8 (patch) | |
tree | 2a18ceca967bb988f6da6b1cc9b336dd25b40d22 /share | |
parent | ff633e81a1efd932018daa1f887a77d263e4e315 (diff) | |
download | txr-d38e9a82b7bdff9f990ff5c5650366890f16cfe8.tar.gz txr-d38e9a82b7bdff9f990ff5c5650366890f16cfe8.tar.bz2 txr-d38e9a82b7bdff9f990ff5c5650366890f16cfe8.zip |
Define suspend operator.
* lisplib.c (yield_set_entries): Added "suspend" to
end of name.
* share/txr/stdlib/yield.tl (suspend): New macro.
* txr.1: Documented suspend. Replaced subtly incorect
shift/reset implementation example with suspend implementation.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/yield.tl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/share/txr/stdlib/yield.tl b/share/txr/stdlib/yield.tl index 236faaa8..3b58ace2 100644 --- a/share/txr/stdlib/yield.tl +++ b/share/txr/stdlib/yield.tl @@ -64,3 +64,11 @@ (defmacro yield (form) ^(yield-from nil ,form)) + +(defmacro suspend (:form form name var . body) + (with-gensyms (cap val) + ^(tree-bind (,cap . ,val) (sys:capture-cont ',name ',form) + (if ,cap + (let ((,var ,val)) + (sys:abscond-from ,name ,*body)) + ,val)))) |