ascii-string? predicate Lassi Kortela (20 Sep 2019 09:51 UTC)
Re: ascii-string? predicate John Cowan (20 Sep 2019 18:25 UTC)
ascii-string/char/byte/bytevector predicates Lassi Kortela (20 Sep 2019 19:53 UTC)
Re: ascii-string/char/byte/bytevector predicates John Cowan (20 Sep 2019 20:20 UTC)
Re: ascii-string/char/byte/bytevector predicates Lassi Kortela (20 Sep 2019 20:26 UTC)
Re: ascii-string/char/byte/bytevector predicates Shiro Kawai (20 Sep 2019 22:22 UTC)
Re: ascii-string/char/byte/bytevector predicates Lassi Kortela (20 Sep 2019 22:52 UTC)
Re: ascii-string/char/byte/bytevector predicates Shiro Kawai (21 Sep 2019 03:48 UTC)
Re: ascii-string/char/byte/bytevector predicates Lassi Kortela (21 Sep 2019 09:24 UTC)
Re: ascii-string/char/byte/bytevector predicates Lassi Kortela (21 Sep 2019 09:28 UTC)

ascii-string? predicate Lassi Kortela 20 Sep 2019 09:51 UTC

John:
 > 5) Add predicates ascii-codepoint? and ascii-string?.  The latter
will be very valuable.

It may be a good idea to add `ascii-string?` but what would be its
semantics?

- Obviously a zero-length string should be considered an ASCII string.

- Otherwise, all codepoints need to be ASCII 0..127.

- What about control characters? Probably a string with ASCII control
characters should count as an ASCII string, even if control characters
often cause problems.

Note that you can already do:

(import (srfi 13) (srfi 175))
(string-every ascii-char? "") => #t
(string-every ascii-char? "hello world") => #t
(string-every ascii-char? "hello wörld") => #f

And it's more versatile than an `ascii-string?`:

(string-every ascii-char? "\0") => #t
(string-every ascii-display? "\0") => #f
(string-every ascii-lower-case? "hello") => #t
(string-every ascii-lower-case? "hello world") => #f
(string-every ascii-alphabetic? "HELLOworld") => #t

Do you have particular arguments or examples where `ascii-string?` would
be better than just using string-every with one of the existing predicates?