chickadee » sexp-diff

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

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.

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)))
 (sexp-diff
  '(DEFUN F (X) (+ (* X 2) 4 4 1))
  '(DEFUN F (X) (- (* X 2) 5 5 3 1)))
 
 ==>
 
 ((DEFUN F (X) (#:new - #:old + (* X 2) #:new 5 #:new 5 #:new 3 #:old 4 #:old 4 1)))

Authors

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

License

LGPL

History