On this page:
identifier->symbol
symbol->identifier
identifier->string
string->identifier
identifier-append
8.12

1 identifier module🔗ℹ

 (require syntax/identifier) package: syntax-extension

procedure

(identifier->symbol id)  symbol?

  id : identifier?
Convert an identifier to a symbol.

Examples:
> (identifier->symbol #'revise)

'revise

> (identifier->symbol #'arc+)

'arc+

> (identifier->symbol #'| - |)

'| - |

procedure

(symbol->identifier sym [srcloc])  identifier?

  sym : symbol?
  srcloc : (or/c #f syntax? srcloc?) = #f
Convert a symbol to an identifier.

Example:
> (symbol->identifier 'abc)

#<syntax abc>

When srcloc is provided, the srcloc of the result will follow the given.

Examples:
> (define srcloc #'id)
> (symbol->identifier 'abc srcloc)

#<syntax:eval:5:0 abc>

procedure

(identifier->string id)  string?

  id : identifier?
Convert an identifier to a string.

Examples:
> (identifier->string #'abc)

"abc"

> (identifier->string #'+-*/@~*&%$)

"+-*/@~*&%$"

> (identifier->string #'||)

""

> (identifier->string #'| - |)

" - "

procedure

(string->identifier str [srcloc])  identifier?

  str : string?
  srcloc : (or/c #f syntax? srcloc?) = #f
Convert a string to an identifier.

Example:
> (string->identifier "abc")

#<syntax abc>

When srcloc is provided, the srcloc of the result will follow the given.

Examples:
> (define srcloc #'id)
> (string->identifier "abc" srcloc)

#<syntax:eval:12:0 abc>

procedure

(identifier-append ids ... [#:srcloc srcloc])  identifier?

  ids : identifier?
  srcloc : (or/c #f syntax? srcloc?) = #f
Concat multiple identifier into one.

Examples:
> (identifier-append #'ab #'c)

#<syntax abc>

> (identifier-append #'hello #'- #'world)

#<syntax hello-world>

When srcloc is provided, the srcloc of the result will follow the given.

Examples:
> (define srcloc #'id)
> (identifier-append #'hello #'-world
                     #:srcloc srcloc)

#<syntax:eval:16:0 hello-world>