【发布时间】:2023-03-30 06:20:01
【问题描述】:
我正在尝试从一个列表中打印对,有点像方案中的一个子集,但有两个元素,就像这样
(1 2 3 4 5)
((1 2) (1 3) (1 4) (1 5) (2 3) (2 4) (2 5) (3 4) (3 5) (4 5))
我写的代码不行
(define (subset x)
(if ( null? x) x
(map cons x (subset (cdr x)))))
这只是返回一个空列表
【问题讨论】:
标签: scheme lisp racket mit-scheme