【发布时间】:2021-03-20 15:58:55
【问题描述】:
(apply string-replace ";" "" '("a" "b;" "c"))
给我错误信息
string-replace: arity mismatch;
the expected number of arguments does not match the given number
expected: 3 plus an optional argument with keyword #:all?
given: 5
arguments...:
据我了解,问题在于列表是 consed 到 string-replace 函数的参数,而我想 apply 函数到列表的每个元素。
applystring-replace 到列表的正确方法是什么?
(apply string-replace "b" "" '("b;"))
有效,但返回"b;bb;,而我本来期望"b"。
【问题讨论】:
标签: functional-programming scheme racket