;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.projectional-editor) ;;;;;; ;;; Sequential projection (def class* projection/sequential (projection) ((elements :type sequence))) ;;;;;; ;;; Projection constructors (def (function e) make-projection/sequential (elements) (make-instance 'projection/sequential :elements elements)) ;;;;;; ;;; Sequential printer (def method project-document (document (projection projection/sequential)) (iter (for current-document :initially document :then (project-document current-document current-projection)) (for current-projection :in-sequence (elements-of projection)) ;; TODO: mapping (finally (return current-document)))) ;;;;;; ;;; Sequential reader ;; TODO: KLUDGE: what is this? do we really need this? (def class* xxx () ((document :type document) (operation :type operation))) (def method read-operation (document (projection projection/sequential) xxx) (iter (for current-document :initially (project-document document projection) :then (document-of (source-of current-document))) (for current-source = (source-of current-document)) (while current-source) (for current-projection = (projection-of current-source)) (for current-xxx :initially xxx :then (make-instance 'xxx :document current-document :operation (read-operation (document-of current-source) current-projection current-xxx))) (finally (return (or (operation-of current-xxx) (call-next-method))))))