0

I am writing test code using guile/scheme and i tried to extract each line of a text file as a string and used (eval-string str) to evaluate the expresion in the string. But, i get In procedure scm_lreadr: #<unknown port>:1:42: end of file in string constant error. So, how can i remove the end of file #<eof> object from the end of the string i want to evaluate using (eval-string str). Here is the sample code

(define (test-func)
(call-with-input-file "tests.txt"
    (lambda (port)
(while #t
  (let ((line (get-line port)))
  (if (eof-object? line) (break))
  (set! line (string-trim line))
  (display (format #f "-> ~a\n"line))
  (set! line (string-trim (substring line 1)))
  (display (format #f "~a\n" line))
  (eval-string line)
)))))
Kira KE
  • 1
  • 1

0 Answers0