List complement operator
- To: mathgroup at smc.vnet.net
- Subject: [mg84950] List complement operator
- From: zac <replicatorzed at gmail.com>
- Date: Mon, 21 Jan 2008 04:06:27 -0500 (EST)
Dear group, I'm loooking for an elegant and efficient way to subtract a list (not a set) from an other one. a = {1, 1, 1, 2, 3, 3, 4, 5, 5, 5, 2, 6, 7, 7}; b = {1, 2, 2, 3, 4, 7, 8}; Complement[a,b] returns {5, 6}, as expected. However I would like to treat each entry as a discrete element, therefore my target result is: {1, 1, 3, 5, 5, 5, 6, 7}. Union can not be used, although Sort is allowed (ie. whether the result is sorted or not is of no concern). Any idea? Istvan Zachar
- Follow-Ups:
- Re: List complement operator
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: List complement operator