SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defun too (state)
  2.   (tagbody
  3.      (if (null state)
  4.          (progn
  5.            (print 'set)
  6.            (return-from too (lambda () (go next))))
  7.          (progn
  8.            (print 'call)
  9.            (funcall state)))
  10.      (go done)
  11.    next
  12.      (print 'hi)
  13.    done))
  14.  
  15. (defun foo ()
  16.   (let ((state (too nil)))
  17.     (funcall state))
  18.   (values))
  19.  
  20. (progn (compile 'too)
  21.        (compile 'foo))
  22.  
  23. (handler-case (foo)
  24.   (error (err) (princ err) (terpri)))
  25.  
  26. set Can't throw to tag (#<ccl::cant-throw-error #x302002691E5D> . 1152921504606846975)
  27.  
  28.  
  29.  
  30. (defun foo ()
  31.   (let ((state nil))
  32.     (dotimes (i 2)
  33.       (tagbody
  34.          (if (null state)
  35.              (progn
  36.                (print 'set)
  37.                (setf state (lambda () (go next))))
  38.              (progn
  39.                (print 'call)
  40.                (funcall state)))
  41.          (go done)
  42.        next
  43.          (print 'hi)
  44.        done)))
  45.   (values))
  46. (compile 'foo)
  47. (foo)
  48.  
  49. set
  50. call
  51. hi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top