这是一个代码,它会删除'重复:
(define (positions list)
(sort (foldl (lambda (x y) (if (not (member? x y)) (append (list x) y) y)) empty list) <))
当我测试时:
(positions (list 3 4 4 5 8 9 4 1 2 9))
我收到错误function call: expected function, given: (list 3 4 4 5 8 9 4 1 2 9)
但是当我用(list x)
替换(cons x '())
时,它就可以了。为什么? Aren都是一样的吗?