Count pairs as having size 1, not 0, in minimizing edit distance.
This commit is contained in:
parent
73dbf42e0e
commit
cb6d78698b
|
@ -19,4 +19,8 @@
|
|||
|
||||
(sexp-diff '(defun f (x) (+ (* x 2) 4 4 1))
|
||||
'(defun f (x) (- (* x 2) 5 5 3 1)))
|
||||
=> '((defun f (x) #:new (- (* x 2) 5 5 3 1) #:old (+ (* x 2) 4 4 1))))
|
||||
=> '((defun f (x) (#:new - #:old + (* x 2) #:new 5 #:new 5 #:new 3 #:old 4 #:old 4 1)))
|
||||
|
||||
(sexp-diff (list 1 (list 2) 3) (list 1 (list 4) 3))
|
||||
=> '((1 (#:new 4 #:old 2) 3))
|
||||
)
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
;; Computes the number of atoms contained in TREE.
|
||||
(define (tree-size tree)
|
||||
(if (pair? tree)
|
||||
(apply + (map tree-size tree))
|
||||
(apply + 1 (map tree-size tree))
|
||||
1))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user