www.delorie.com/gnu/docs/guile/guile_459.html   search  
 
Buy GNU books!


Guile Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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.

Example:

 
(define-reader-ctor 'file open-input-file)
(define f '#,(file "/etc/passwd"))
(read-line f)
=>
"root:x:0:0:root:/root:/bin/bash"

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

Scheme Procedure: define-reader-ctor symbol proc
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.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003