File size: 752 Bytes
43203b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(cl:in-package :cl-flow)


;;;
;;; DYNAMICALLY
;;;
(defun dispatch-dynamically (flow-context body-fu)
  (declare (type (function (t) *) body-fu)
           #.+optimize-form+)
  (push-flow-stack flow-context (funcall body-fu (flow-context-value flow-context)))
  (dispatch-rest flow-context))


(defmacro dynamically (lambda-list &body body)
  "Generates new flow dynamically during parent flow execution. In other words,
injects new dynamically created flow into a current one. Non-consing."
  (flow-lambda-macro (flow-context)
    (with-flow-function-macro (body-fu lambda-list body)
      `(dispatch-dynamically ,flow-context #',body-fu))))


(defmacro ->> (lambda-list &body body)
  "See flow:dynamically"
  `(dynamically ,lambda-list
     ,@body))