[REBOL] Function to compare two scripts?
From: SunandaDH::aol::com at: 21-Aug-2003 11:49
Hi there,
I think something like this has been posted before, but I can't find it.
I'd like to be able to compare two scripts (or any pair of newline-separated
text items) and get a block of the differences.
Can anyone help?
As an example of the sort of thing I'm looking for:
version-1: {
rebol [
name: "fred"
title: "test script"
]
print "test"
haltt}
version-2: {
REBOL [
name: "fred"
title: "test script"
history: [21-aug-2003 "Fixed exit problem"]
halt}
differences: delta-script version-1 version-2
;; I'd like output something like:
foreach diff differences [print diff]
line 1 replace "rebol [" "REBOL ["
line 4 insert {history: [21-aug-2003 "Fixed exit problem"]}
line 6 delete {print "test"}
line 7 replace "hallt" "halt"
Thanks!
Sunanda.