* char-set-contains? and #<eof>
@ 2010-05-28 3:24 No Itisnt
2010-05-28 9:21 ` Ludovic Courtès
2010-05-28 20:52 ` No Itisnt
0 siblings, 2 replies; 4+ messages in thread
From: No Itisnt @ 2010-05-28 3:24 UTC (permalink / raw)
To: guile-user
It's getting pretty annoying that char-set-contains? rejects #<eof>.
Is there a way around this without wrapping it myself? Is that
behavior intended? Because to me, it seems like it'd be more
reasonable to return #f when passed #<eof>.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: char-set-contains? and #<eof>
2010-05-28 3:24 char-set-contains? and #<eof> No Itisnt
@ 2010-05-28 9:21 ` Ludovic Courtès
2010-05-28 20:52 ` No Itisnt
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2010-05-28 9:21 UTC (permalink / raw)
To: guile-user
Hi,
No Itisnt <theseaisinhere@gmail.com> writes:
> It's getting pretty annoying that char-set-contains? rejects #<eof>.
It makes sense to me given that SRFI-14 (informally) defines the second
argument as being a character (and #<eof> is not a character):
http://srfi.schemers.org/srfi-14/srfi-14.html#char-set-contains-p
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: char-set-contains? and #<eof>
2010-05-28 3:24 char-set-contains? and #<eof> No Itisnt
2010-05-28 9:21 ` Ludovic Courtès
@ 2010-05-28 20:52 ` No Itisnt
2010-05-30 18:08 ` Andy Wingo
1 sibling, 1 reply; 4+ messages in thread
From: No Itisnt @ 2010-05-28 20:52 UTC (permalink / raw)
To: guile-user
R5RS specifies that character predicates should return #f, and Guile's
character predicates are implemented in terms of char-set-contains?
R6RS says the same for char-set-contains?
The reason it bothers me is because it makes it cumbersome to deal
with input from a port. Case in point:
> $ grep "(and (not (eof-object\?" -R module
> module/sxml/upstream/SSAX.scm: (and (not (eof-object? c)) (char-alphabetic? c) c)) port)))
> module/language/elisp/lexer.scm: (and (not (eof-object? tested))
> module/language/ecmascript/tokenize.scm: (and (not (eof-object? c))
> module/language/ecmascript/tokenize.scm: (cond ((and (not (eof-object? c)) (char-numeric? c))
> module/language/ecmascript/tokenize.scm: (cond ((and (not (eof-object? c)) (char-numeric? c))
> module/system/repl/repl.scm: (if (and (not (eof-object? ch)) (char-whitespace? ch))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: char-set-contains? and #<eof>
2010-05-28 20:52 ` No Itisnt
@ 2010-05-30 18:08 ` Andy Wingo
0 siblings, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2010-05-30 18:08 UTC (permalink / raw)
To: No Itisnt; +Cc: guile-user
Hi,
On Fri 28 May 2010 22:52, No Itisnt <theseaisinhere@gmail.com> writes:
> R5RS specifies that character predicates should return #f,
One may interpret the language of the R5RS to permit raising an error if
the argument is not a character. Same with the R6RS. This is the tack
that Guile has taken.
For example, what would you have Guile do here:
(even? #f) => ?
(char-whitespace? 42) => ?
> The reason it bothers me is because it makes it cumbersome to deal
> with input from a port.
True; but it's just how it is, I think. The EOF object is not a
character.
Regards,
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-30 18:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-28 3:24 char-set-contains? and #<eof> No Itisnt
2010-05-28 9:21 ` Ludovic Courtès
2010-05-28 20:52 ` No Itisnt
2010-05-30 18:08 ` Andy Wingo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).