I am not able to understand the error with the code below which simply prints the length of the string:
(define codeLen (read))
(display codeLen)
(define code (read))
(display code)
(string-length code)
I am getting an error: string-length: expects argument of type <string>; given a
You’ve probably entered
a.readreads an arbitrary piece of s-expression, and in this case, it reads the symbola. If you enter"a"instead, you will get a string.But more likely you will want to use the
read-linefunction.