-
Notifications
You must be signed in to change notification settings - Fork 9
fix "out of bounds" #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think this is mostly OK; I don't remember a lot of the details of the algorithm, though. Comments coming inline on the diff itself. |
:length 0) | ||
|
||
(defun compute-lcs* (original modified) | ||
(declare (optimize (debug 3))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This declaration should be removed.
As I was commenting, I took a closer look at the code...does all this really stem from the initial creation of FP sharing a snake between all elements of FP? If so, wouldn't it be easier to simply initialize FP differently, by dropping the :INITIAL-ELEMENT and doing: (loop for i from 0 below (length fp) ? Like I said, I don't remember all the details of the algorithm, but looking at the code, my use of :INITIAL-ELEMENT there is very suspect. |
Well, I rewrote the code. Unfortunately, I'm not familiar with this algorithm and has not had the time I use a diff for: http://cliki2.lisper.ru/history/RESTAS/3470385331-3488861177, P.S. I apologize for my terrible english. |
I has united my changes on this issue in one commit |
I sync this branch with last changes. |
Hi. I would not want to seem intrusive, but is now important for me to get result on this issue. You could not dedicate this issue a little bit of his time? :) |
Hi, sorry for not responding. I'm not completely convinced that this can't be solved by simply initializing all the members of the FP array with their own instance of a SNAKE, rather than sharing one between them all. That should be an equivalent solution to what you're doing, but be somewhat clearer. Could you try that solution instead? |
Oh, I looked at solutions in other languages and found that this bug can be corrected very simple manner. |
OK, so I agree that fix is quite simple. :) But why does that fix things? Why 3 and not 4, or 2? |
Yes, I know it does not very impressive, but I found 3 in the Python implementation and test it on their data. 1 or 2 is not enough if the original and modified texts do not have common parts. 3 was sufficient in all cases. |
Do you have a reference for the Python implementation? I know Python's standard library uses a different algorithm. Honestly, the code was copied from other implementations originally, so I'm not opposed to a bit more copying. I'd just like to have a shot at understanding why we're copying this bit. |
https://github.com/cubicdaiya/onp/blob/master/python/onp.py In addition, this project have the implementation of this algorithm and the other languages. |
Well, they have a lot of helpful comments, don't they? Pulling; thanks for the fix. |
Fix for https://github.com/froydnj/diff/issues/1