chickadee » sexp-diff

sexp-diff

Introduction

Diffs s-expressions based on Levenshtein-like edit distance.

Documentation

DIFF-SEXP computes a diff between two s-expressions which minimizes the number of atoms in the result tree, also counting edit conditionals #:new, #:old. The OLD & NEW markers are parameterized.

sexp-diff

sexp-diff OLD NEWprocedure
OLD
any ; original s-expression
NEW
any ; replacement s-expression

sexp-diff-markers

sexp-diff-markers #!optional MARKERSparameter
MARKERS
(list keyword keyword) ; keywords for OLD & NEW.

Examples

 (sexp-diff
  '(DEFUN F (X) (+ (* X 2) 1))
  '(DEFUN F (X) (- (* X 2) 3 1)))
 ==>
 ((DEFUN F (X) (#:new - #:old + (* X 2) #:new 3 1)))
 (sexp-diff
  '(DEFUN F (X) (+ (* X 2) 4 1))
  '(DEFUN F (X) (- (* X 2) 5 3 1)))
 ==>
 ((DEFUN F (X) (#:new - #:old + (* X 2) #:new 5 #:new 3 #:old 4 1)))
 (parameterize ((sexp-diff-markers (list #:❌ #:✅)))
   (sexp-diff
    '(DEFUN F (X) (+ (* X 2) 4 4 1))
    '(DEFUN F (X) (- (* X 2) 5 5 3 1))) )
 ==>
 ((DEFUN F (X) (#:✅ - #:❌ + (* X 2) #:✅ 5 #:✅ 5 #:✅ 3 #:❌ 4 #:❌ 4 1)))

Authors

Michael Weber, ported to racket by Vincent St-Amour, ported to CHICKEN by felix winkelmann. CHICKEN 5 by Kon Lovett.

Bugs & Limitations

License

LGPL

History

0.4.0
Added sexp-diff-markers
0.3.0
CHICKEN 5
0.2.1
Fixed tests (correct exit status)
0.2
Fixed meta file (added category)
0.1
Initial import

Contents »