Reputation: 81
first, I want to transform the string type data to list type in order to implement the "reverse" function.But, I can't do it!The code like:
(define p (open-input-file "test.txt"))
(define c (read-line p))
(close-input-port p)
(string->list c)
(reverse c)
I do not know where the errors are? Why cant i just transform the type. I need ur guys help, thankS!
Upvotes: 0
Views: 62
Reputation: 236142
Try this:
(reverse (string->list c))
Remember: in Scheme all standard list functions return values that must be used or stored somewhere, they don't modify objects in-place.
Upvotes: 1