开发者

Common lisp, undefined intersection function behaviour?

According to CLHS entry for the INTERSECTION function (http://www.lispworks.com/documentation/HyperSpec/Body/f_isec_.htm):

For every pair that satifies the test, exactly one of the two elements of the pair will be put in the result.

My problem is that i need to know which one of the two elements of the pair will be put in the result, which matters when, for example :key #'car is used to extract the arguments to test against, since the cdr might be different. I would like to have a guarantee that either always the first or always the second element will be put in 开发者_运维知识库the result. Am I missing something or is this just unspecified behaviour, so I shouldnt use it for my case?


intersection simply doesn't make the guarantee you want; it implements set-theoretic intersection with a lot of extras, but just not that extra. You'll have to roll your own.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜