Hi everyone,
I'm trying to write a program (in emacslisp) to calculate the difference of two lists; could someone give me a hint as to why my code is returning an error saying "invalid function...", when I try it on an example?
I'd be grateful for help,
Thanks
I'm trying to write a program (in emacslisp) to calculate the difference of two lists; could someone give me a hint as to why my code is returning an error saying "invalid function...", when I try it on an example?
I'd be grateful for help,
Thanks
(defun diff (A B)
; calculates A\B
(setq index 0)
(if (or (equal A []) (equal B []))
(print A)
(; else:
(while (< index (length A))
(
(if (string-equal (elt A index) (car B))
((aset A index (elt A 0)) (setq A (cdr A)))
)
(setq index (+ index 1))
)
)
(diff (A (cdr B)))
)
)
)
(diff [1 a c 5] [1 3 "foo" 4 7])