Hello!

Sorry for the late reply.

Germán Diago <germandi...@gmail.com> skribis:

> (define (file->lines filename)
>   "Returns a list of lines contained in a file"
>   (call-with-input-file
>       filename
>     (lambda (p)
>       (let loop ([line (read-line p)])
>         (if (eof-object? line) (list)
>             (cons
>              (substring line 0 (1- (string-length line)))
>              (loop (read-line p))))))))

UTF-8 I/O is usually faster in Guile 2.0.  You might want to make sure
your file is opened as UTF-8:

  (with-fluids ((%default-port-encoding "UTF-8"))
    (call-with-input-file file …))

Ludo’.


Reply via email to