Skip to content

Instantly share code, notes, and snippets.

@vseloved
Created May 8, 2014 16:49
Show Gist options
  • Save vseloved/5aba2ab2b1893a8fa0f7 to your computer and use it in GitHub Desktop.
Save vseloved/5aba2ab2b1893a8fa0f7 to your computer and use it in GitHub Desktop.
(defun am->br (am br amf)
(flet ((str->arr (str)
(make-array (length str) :initial-contents (coerce str 'list))))
(with-accessors ((as diff:original-start) (al diff:original-length)
(bs diff:modified-start) (al diff:modified-length))
(find (find-class 'diff:modified-diff-region)
(diff:compute-raw-diff (str->arr am)
(str->arr br))
:key 'class-of)
(strcat (slice amf 0 as)
(slice br bs (+ bs bl))
(slice amf (+ as al))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment