Does Common Lisp have a something like java's Set Interface/implementing classes?

前端 未结 8 1109
无人及你
无人及你 2021-01-12 01:58

I need something like this, a collection of elements which contains no duplicates of any element. Does Common Lisp, specifically SBCL, have any thing like this?

8条回答
  •  佛祖请我去吃肉
    2021-01-12 02:39

    Yes, it has sets. See this section on "Sets" from Practical Common Lisp.

    Basically, you can create a set with pushnew and adjoin, query it with member, member-if and member-if-not, and combine it with other sets with functions like intersection, union, set-difference, set-exclusive-or and subsetp.

提交回复
热议问题