Hi Lutz,
Im running into a problem, I thought that 'Difference returned only the
list of differences, but it also seems that it returns a Unique list. And that
is quiet annoying ;-) We have already 'Unique ' Intersect 'Filter and 'Difference
but none of those does return a difference!
Oke i could use map..but i like the simplicity of difference...
Anything that could make difference realy differ?
Norman.
'difference' is true to the mathematical defintion of set difference as A B. The following link explains the difference between A - B (your suggestion) and A B (how its implemented):
http://planetmath.org/encyclopedia/SetDifference.html
Lutz
The next version (development 8.6.1, due coming weekend) will contain an optional flag in 'difference' and 'intersect' to put these in list mode versus set mode and not eliminate duplicates:
; normal set mode
(difference '(2 5 6 0 3 5 0 2) '(1 2 3 3 2 1)) => (5 6 0)
; optional list mode
(difference '(2 5 6 0 3 5 0 2) '(1 2 3 3 2 1) true) => (5 6 0 5 0)
; normal set mode
(intersect '(3 0 1 3 2 3 4 2 1) '(1 4 2 5)) => (2 4 1)
; optional list mode
(intersect '(3 0 1 3 2 3 4 2 1) '(1 4 2 5) true) => (1 2 4 2 1)
This makes it easy to filter lists from a list of allowed or not-allowed elements. Note that even in list mode the second list is always taken unique as a set.
Lutz
Thanks ! great addon ;-)
Nice! I encountered the same problem last week.
Thanks
Peter