When I run this program on my mac, I get the output that Quico predicts (i.e., the two return the same thing and there is no terminating empty list).
#lang racket (require 2htdp/batch-io) (parameterize ([current-input-port (open-input-string "first line\n\nthird line\n")]) (read-words/line 'stdin)) (parameterize ([current-input-port (open-input-string "first line\n\nthird line")]) (read-words/line 'stdin)) Robby On Sat, Apr 16, 2016 at 9:32 AM, Matthias Felleisen <matth...@ccs.neu.edu> wrote: > > I cannot reproduce this behavior on my Mac 10.11. After reading the code of > the library, I also don’t see why Linux should behave differently. The > file’s history also doesn’t show a problem report concerning this issue. — > Matthias > > > > >> On Apr 15, 2016, at 9:39 PM, Quico Jurado <quico.jur...@gmail.com> wrote: >> >> Hello, I posted this question in SO, but hoping to get more answers here. >> >> I'm reading Part two from the 2htdp book, and I'm curious about the behavior >> of the read-words/line function that lives under 2htdp/batch-io. >> >> I created two different files, the first file having a \n at the end of the >> file and the second file without it, like this: >> >> echo -ne "first line\n\nthird line\n" > file1.txt >> echo -ne "first line\n\nthird line" > file2.txt >> >> if I read each one of the files with the read-words/line, this is the result: >> >> (read-words/line "doc/book/htdp2/data/file1.txt") >> ; => '(("first" "line") () ("third" "line")) >> >> (read-words/line "doc/book/htdp2/data/file2.txt") >> ; => '(("first" "line") () ("third" "line")) >> >> It looks that the function isn't preserving the information from the last >> newline character in the first file. >> >> Is that behavior intended? >> >> I'm Running Dr Racket 6.2.1 on a GNU/Linux box. >> >> Thanks, >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to racket-users+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.