Message 1 of 12
Updating list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a list of real numbers (going upto 5 decimals). I want to run through the list and check every element to the previous one and if they match then increment the element (n + 1) by 0.00001 over element n, so they are different. Here is my code
(setq x 1) (setq y (length lst1)) (while (< x y) (if (= (- (nth x lst1) (nth (- x 1) lst1)) 0) (progn (setq lst1 (subst (+ 0.00001 (nth x lst1)) (nth x lst1) lst1)) (setq x (+ x 1))) (setq x (+ x 1))))
Nothing seems to change. I retrieve the values using rtos upto 6 decimals and nothing changes. What is going wrong? Thanks in advance.