标签云

微信群

扫码加入我们

WeChat QR Code


You might want to clarify what you mean with "better".

2018年09月25日38分45秒

Did you try the untested snippet and did it work? I'd love to edit my answer so that the generations after us don't have to live in fear of the snippet crashing their Lisp 3000...

2018年09月25日38分45秒

I did indeed test it and it did indeed work. Many thanks for the answer.

2018年09月25日38分45秒

First, is sort-fn compatible with equal? i.e., does (sort-fn a b) = NIL and (sort-fn b a) = NIL imply (equal a b) = T? Second, you should merge after sort for speed. Third, sort-fn should be named compare or something similar.

2018年09月26日38分45秒

I knew there was an elegant way of doing this :)

2018年09月26日38分45秒

This is not elegant - this is quadratic in sum of lengths of the lists instead of linearithmic in the length of the longest list.

2018年09月26日38分45秒

Probably not. According to HyperSpec it does not require the list to be ordered.

2018年09月25日38分45秒

Sets are generally not sorted.

2018年09月26日38分45秒

RKitson has a point. If it's easy to use sets, then one never has to deal with duplicates in the first place. On the other hand, to use sets one needs to map from the animalcules used by dsm to integers. This sounds nontrivial. I came here with a similar question, and mapping to integers would not have been easy.

2018年09月26日38分45秒