No, forget what I just wrote, this is obvious. Pierre On 02/07/2016 04:39, Mark H Weaver wrote: > Hi, > > Pierre Lairez writes: > >> I understand why we cannot use (eof-object) in a “case” statement. For >> example, this will not run as it is meant: >> (case (get-char port) >> (((eof-object)) ...) >> (else ...)) >> >> Is is possible to define something like #eof that will be datum and make >> the following work as expected? >> (case (get-char port) >> ((#eof) ...) >> (else ...)) > We cannot make a 'read'able datum that is an eof object, because of the > API of 'read'. When 'read' returns an eof object, that means that the > end of file has been reached, and that's how existing callers of 'read' > will interpret such a result. > > I would suggest using (ice-9 match) instead, e.g.: > > (match (get-char port) > ((? eof-object?) 'eof) > ((or #\a #\b) 'a-or-b) > (#\c 'c) > (char 'other-character)) > > See section 7.7 (Pattern Matching) in the Guile manual. > Does that work for you? > > Regards, > Mark