guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SRFI-10 and #.


From: Martin Grabmueller
Subject: Re: SRFI-10 and #.
Date: Mon, 30 Apr 2001 15:44:09 +0200 (MET DST)

> From: "Dale P. Smith" <address@hidden>
> Date: Fri, 27 Apr 2001 14:58:44 -0400
> 
> How close is the #. read-hash-extension (in boot-9.scm) to srfi-10?
> 
> If it's the same (or close), shouldn't it be changed to #, (and fixed if
> need be)?

#. is not compatible to #, (in SRFI-13), because it is the same as
Common Lisp's #.

#. is defined as

#.obj === (eval obj)

whereas #, (SRFI-10) is defined as

#,obj === (apply (lookup (car obj)) (cdr obj))

That means that the OBJ in #, must be a list with a CAR equal to a
handler registered explicitly  for #, .

But I think that implementing such a read extension should be very
easy.

E.g. (beware, untested)

(define hash-comma-table (make-hash-table 31))

(define (lookup s)
        (hash-ref hash-comma-table s))

(read-hash-extend #\,
        (lambda (c port)
          (let (l (read port))
             (if (and (list? l) (positive? (length l)))
                 (apply (lookup (car l)) (cdr l))
                 (error ",# syntax error")))))

and appropriate procedures registered in `hash-comma-table'.

Regards,
  'martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]