Email list hosting service & mailing list manager

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/char/byte/bytevector predicates Lassi Kortela 20 Sep 2019 19:53 UTC

> Yes to all three.

Works for me too.

> SRFI 13 (and its successors) are much more heavyweight than SRFI 175.  If
> you know that strings are ASCII strings, you can use SRFI 175; this
> predicate serves as a dynamic type check.
>
> Now that I think of it, ascii-bytevector? is good too (are all the elements
> ASCII codepoints?)

I still find it hard to see specific use cases, but the procedures are
also very simple and match existing procedures such as `string?` and
`bytevector?`, so I don't want to be a stickler. Let's just add them.

How about:

ascii-byte? -- is an integer 0..127
ascii-char? -- is a character representing ASCII 0..127

ascii-bytevector? -- is a bytevector, has no bytes outside 0..127
ascii-string? -- is a string, has no chars outside ASCII 0..127

I like the word `byte` because it matches `bytevector` (and would also
match `read-byte` is Scheme had it under that common namd; `ascii-u8?`
doesn't quite have the same punch as `ascii-byte?`)