Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Function to compare two scripts?

From: SunandaDH:aol at: 22-Aug-2003 7:36

Thanks Gregg:
> Not polished, lots of "idea" stuff in there > cluttering things up, but maybe something you can use.
Very clever code, but a couple of problems: First, it gets confused by completely different strings, or case differences:
>> print mold diff/create "aaa" "bbb"
[]
>> print mold diff/create "aaa" "bbbAAA"
[]
>> print mold diff/create "AAA" "bbbAAA"
[ remove/part at result 1 3 append clear at result 4 [""]] Second, more important for my purposes, the output isn't very human readable. Take my example: 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} print mold diff/create version-2 version-1 [ change/part at result 2 ["REBOL"] 5 insert at result 56 ["h"] remove/part at result 57 5 change/part at result 58 ["s"] 1 insert at result 60 ["ory:"] insert at result 65 ["[21-aug-2003 "] insert at result 79 ["Fixed exi"] insert at result 89 [" probl"] insert at result 96 ["m"] remove/part at result 97 2 insert at result 98 ["]"] insert at result 100 ["^/"] append clear at result 105 [""]]
>>
It's not at all obvious what the edits are that a *human* did to go from one version to the next. I've taken a look at your code, but I can't see any obvious way to morph it into something that reports differences by lines. Sunanda.