Node:SRFI-10, Next:, Previous:SRFI-9, Up:SRFI Support

39.9 SRFI-10 - Hash-Comma Reader Extension

The module (srfi srfi-10) implements the syntax extension #,(), also called hash-comma, which is defined in SRFI-10.

The support for SRFI-10 consists of the procedure define-reader-ctor for defining new reader constructors and the read syntax form

#,(ctor datum ...)

where ctor must be a symbol for which a read constructor was defined previously, using define-reader-ctor.


(define-reader-ctor 'file open-input-file)
(define f '#,(file "/etc/passwd"))
(read-line f)

Please note the quote before the #,(file ...) expression. This is necessary because ports are not self-evaluating in Guile.

define-reader-ctor symbol proc Scheme Procedure
Define proc as the reader constructor for hash-comma forms with a tag symbol. proc will be applied to the datum(s) following the tag in the hash-comma expression after the complete form has been read in. The result of proc is returned by the Scheme reader.