in reply to array difference

This topic reminds me of set theory stuff, which I use a lot in SQL. Has anyone implemented array set functions (i.e. intersect, union, etc.) in a module anywhere?