我是Scheme的新手...
有人可以为我解释为什么 for-each 语句不打印输出吗?
我定义了一个图表:
(define graph '((a (b.c)) (c (d))))
和我的测试代码:
(define testing
(lambda (a-list)
(if (null? a-list)
"size = 0"
(for-each (lambda (i)
(cons (car i) (length (cdr i)))
(length a-list))
a-list))))
运行此程序时(testing graph)
,预期的输出是,((a . 2) (c . 1))
但它什么也不显示...