I'm having problems getting the display-lines-to-file working, here is what I have tried:
(define (list-to-file lst file) (display-lines-to-file lst file
#:exists 'replace
#:separator newline #"\n"))
(list-to-file myList "myfile.txt")
myList is a list of data that was read from another file, after processing that data I need to write the contents of the list (including newline characters) to myfile.txt
Racket keyword arguments have a
#:keyword
followed by a single value. The problem seems to be:Instead you want:
I'd suggest a few other changes:
#:separator
is already#"\n"
, omit that.#:mode 'text
so that\n
is automatically translated to\r\n
on Windows.Combining all that: