我的函数必须接受,看起来像这样输入:如何摆脱计划中的额外列表级别?下面
(getlist '(a b '(a b) 1 2 '() '(1 2)))
函数必须然后输出原始列表中的所有表的列表。所以输出应该像
"((a b)()(1 2))"
,但我得到这个:
"((quote (a b)) (quote()) (quote (1 2)))"
我得到正确的价值观,但他们都包裹着附引号额外的名单内。我该如何解决?
谢谢
;function to return all lists in a list
(define (getlist lst)
;if list is empty
(if (null? lst)
;true
'()
;false
(if (list? (car lst))
;true
(cons (car lst) (getlist (cdr lst)))
;false
(getlist (cdr lst)))))
'getlist'实现'filter':'(过滤列表“(AB(AB)1 2()(1 2 )))' – suchtgott