;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.projectional-editor) ;;;;;;;; ;;;; Sequence domain provides: ;;;; - sequence ;;;;;; ;;; Sequence document classes ;;; ;;; The sequence document classes are provided by the Common Lisp implementation. ;;;;;; ;;; Sequence document constructors ;;; ;;; The sequence document constructores are provided by the Common Lisp implementation. ;;;;;; ;;; Sequence operation classes (def class* operation/sequence/replace-element-range (operation) ((target :type reference) (replacement :type sequence))) ;;;;;; ;;; Sequence operation constructors (def (function e) make-operation/sequence/replace-element-range (target replacement) (make-instance 'operation/sequence/replace-element-range :target target :replacement replacement)) ;;;;;; ;;; Sequence operation API implementation (def method redo-operation ((operation operation/sequence/replace-element-range) document) (pattern-case (target-of operation) ((sequence-position (the ?type (?if (subtypep ?type 'sequence)) ?a) ?b) (bind ((old-sequence (reference/find-value document ?a)) (new-sequence (concatenate (form-type old-sequence) (subseq old-sequence 0 ?b) (replacement-of operation) (subseq old-sequence ?b)))) (setf (reference/find-value document ?a) new-sequence))) (?a (not-yet-implemented))))