General Lisp condition system for control transfer

I agree directly that the following is a rather awful description of what I want to do. I apologize in advance. Please ask questions to help me explain. :-)

I wrote ETLs (Extract, Transform, Load) in other languages, which consist of separate operations that look something like this:

// in class CountOperation
IEnumerable<Row> Execute(IEnumerable<Row> rows) {
    var count = 0;
    foreach (var row in rows) {
        row["record number"] = count++;
        yield return row;
    }
}

Then you combine a number of these operations and call the Manager, which is responsible for calling up Operations and pressing data between them.

I'm trying to do something similar in Common Lisp, and I want to use the same basic structure, that is, each operation is defined as a normal function that enters a list and displays a list, but is lazy.

define-condition (have-value) yield - , , . , :

(defun count-records (rows)
   (loop for count from 0
         for row in rows
         do (signal 'have-value :value `(:count ,count @,row))))

, . :

(let ((next-op ...))  ;; pick an op from the set of all ops
  (loop
    (handler-bind
        ((have-value (...)))  ;; records output from operation
    (setq next-op ...)  ;; pick a new next-op
    (call next-op)))

: . Lisp, , : , () , , .

- ? ?

+5
2

Lisp . , . ( cl-cont), "", .

"" (. SICP) ( FORCE DELAY) - SERIES ( ).

+3

, - . . , # , , .

Common Lisp cl-cont.

0

All Articles