分类
联系方式
  1. 新浪微博
  2. E-mail

Racket 集合

介绍

Set 表示不同元素的集合。常用的集合为

Hash Set

Hash Set。

set? 是否是集合

list->set 列表转集合

自动对列表内元素去重。

集合方法

set-intersect 交集

set-union 并集

> (set-union (set))
(set)

> (set-union (seteq))
(seteq)

> (set-union (set 1 2) (set 2 3))
(set 1 2 3)

> (set-union (list 1 2) (list 2 3))
'(3 1 2)

set->list 集合转列表