6.4 mischief/keyword: Keywords
(require mischief/keyword) | package: mischief-dev |
This module re-exports keyword<? from racket/base.
procedure
x : keyword? y : keyword?
procedure
x : keyword? y : keyword?
procedure
(keyword<=? x y) → boolean?
x : keyword? y : keyword?
procedure
(keyword>=? x y) → boolean?
x : keyword? y : keyword?
Compare two keywords lexicographically, essentially composing
keyword->string with string=?, string>?,
string<=?, and string>=?.
Examples:
> (keyword=? '#:bat '#:cat) #f
> (keyword=? '#:cat '#:cat) #t
> (keyword=? '#:cat '#:bat) #f
> (keyword>? '#:bat '#:cat) #f
> (keyword>? '#:cat '#:cat) #f
> (keyword>? '#:cat '#:bat) #t
> (keyword<=? '#:bat '#:cat) #t
> (keyword<=? '#:cat '#:cat) #t
> (keyword<=? '#:cat '#:bat) #f
> (keyword>=? '#:bat '#:cat) #f
> (keyword>=? '#:cat '#:cat) #t
> (keyword>=? '#:cat '#:bat) #t
procedure
(keyword-upcase sym) → keyword?
sym : keyword?
procedure
(keyword-downcase sym) → keyword?
sym : keyword?
procedure
(keyword-titlecase sym) → keyword?
sym : keyword?
procedure
(keyword-foldcase sym) → keyword?
sym : keyword?
Convert the case of a keyword’s name, by analogy with string-upcase,
string-downcase, string-titlecase, and
string-foldcase.
Examples:
> (keyword-upcase '#:Two-words) '#:TWO-WORDS
> (keyword-downcase '#:Two-words) '#:two-words
> (keyword-titlecase '#:Two-words) '#:Two-Words
> (keyword-foldcase '#:Two-words) '#:two-words
procedure
(keyword->symbol key) → symbol?
key : keyword?
procedure
(symbol->keyword sym) → keyword?
sym : symbol?
Convert between symbols and keywords.
Examples:
> (keyword->symbol '#:something) 'something
> (symbol->keyword 'anything) '#:anything
procedure
(format-keyword fmt arg ...) → keyword?
fmt : string? arg : (or/c symbol? string? identifier? keyword? char? number?)
Produces a keyword whose name is (format fmt arg ...). Like
format-symbol, the format string must use only ~a
placeholders, and identifiers in the args are automatically converted
to symbols.
Example:
> (format-keyword "is-~a?" #'list) '#:is-list?