-1
내가 노력하고 다음 코드 :문자열 대체 * 작동하지
그것은 다음과 같은 출력으로 작동(require-extension srfi-13)
(require-extension regex)
(print (string-substitute* "This is a test" '(("a test" . "NO TESTING ZONE"))))
:
This is NO TESTING ZONE
그러나 다음은 작동하지 않습니다
(print (string-substitute* "This is a test" '(("a test" . (string-append "NO " "TESTING")))))
는 다음 오류 :
Error: (string-substitute) bad argument type - not a string: (string-append "NO " "TESTING")
비록, 출력이 실제로 문자열임을 보여줍니다 다음
(print (string? (string-append "NO " "TESTING")))
#t
어디에 문제가 어떻게이는 해결 될 수있다?
왜 'print (string-substitute * "이것은 테스트이다."(리스트 "테스트" "테스트하지 않는다") (리스트 "this" "이"))))' – rnso
@rnso 자동차와 cdr이 둘 다 문자열 인 곳의 쌍 목록이 필요하기 때문에 자동차가 문자열이고 cdr이 목록입니다. – molbdnilo