I was trying out the diff function and I noticed something:

: (diff '(1 2 3 4) '(3 4))
-> (1 2)

but

: (diff '(3 4) '(1 2 3 4))
-> NIL

I think this means that there is an order to the arguments of diff, where
the second argument must be the shortest.
I wanted to ask if this was correct,  and also why was it chosen to be this
way.

I also tried this:

: (diff (1 2 3 4) 2)
-> (1 3 4)

So, why does diff work even if the second argument isn't a list?

I ran (doc 'diff), and though it explained how diff worked, it didn't
answer either of my questions. I'd be grateful for any answers you can give
me, as well as pointers to any document or reference on the internet that
explains these issues.

Thank you very much.

Reply via email to