(missing)
(missing)
(missing)
(missing)
(missing)
(missing)
(missing)
Re: [Scheme-reports] [r6rs-discuss] redefining eqv? Peter Kourzanov (22 Dec 2010 20:32 UTC)
Re: [Scheme-reports] [r6rs-discuss] redefining eqv? Thomas Bushnell, BSG (22 Dec 2010 21:02 UTC)
Re: [Scheme-reports] [r6rs-discuss] redefining eqv? Eli Barzilay (22 Dec 2010 23:37 UTC)
(missing)
(missing)
(missing)
(missing)
Re: [Scheme-reports] [r6rs-discuss] Bigloo Peter Kourzanov (22 Dec 2010 20:35 UTC)
Re: [Scheme-reports] [r6rs-discuss] Bigloo Thomas Bushnell, BSG (22 Dec 2010 21:01 UTC)
Re: [Scheme-reports] [r6rs-discuss] returning back to pattern matching Thomas Bushnell, BSG (22 Dec 2010 21:55 UTC)
Re: [Scheme-reports] [r6rs-discuss] returning back to pattern matching Thomas Bushnell, BSG (23 Dec 2010 19:47 UTC)
Re: [Scheme-reports] [r6rs-discuss] returning back to pattern matching Thomas Bushnell, BSG (24 Dec 2010 00:53 UTC)
Re: [r6rs-discuss] [Scheme-reports] Scheme pattern matching: the case for (case) Aubrey Jaffer (21 Dec 2010 21:34 UTC)

Re: [r6rs-discuss] [Scheme-reports] Scheme pattern matching: the case for (case) Aubrey Jaffer 21 Dec 2010 21:33 UTC

 | From: Peter Kourzanov <peter.kourzanov@gmail.com>
 | Date: Tue, 21 Dec 2010 21:12:32 +0100
 |
 | ... One can consider a (case) pattern to be implicitly quasiquoted
 | (just like traditional case is implicitly quoted).  So, if one
 | needs "extended" (case) capabilities, one would write:
 |
 | (case 'b
 |   ((,a) (list a)))

SCM provides "qase", which honors unquote and unquote-splicing in the
car of clauses.  Here is an example of its use in a Pascal parser:

(define (pascal:tokenize)
  (define chr (readchr))
  (qase chr
    ((#\% ,@(string->list tok:alphabetic))
     (accumulate-alpha-token chr))
    ((,@(string->list tok:decimal-digits))
     (accumulate-numeric chr))
    ((,@(string->list ":=<>"))
     (accumulate-funny-token chr))
    ((#\newline)
     (pascal:tokenize))
    ((,@(remove #\newline (string->list tok:whitespaces)))
     (pascal:tokenize))
    ((#\')
     (accumulate-string))
    ((#\{)
     (read-through! #\})
     (pascal:tokenize))
    ((#\.)
     (cond ((eqv? #\. (peekchr)) (readchr) 'dots)
	   (else #\.)))
    ((#\()
     (case (peekchr)
       ((#\*)
	(read-through! "*)")
	(pascal:tokenize))
       (else chr)))
    (else (cond ((and (eof-object? chr) *pascal-eof-thunk*)
		 (*pascal-eof-thunk*)
		 (pascal:tokenize))
		(else chr)))))

_______________________________________________
r6rs-discuss mailing list
r6rs-discuss@lists.r6rs.org
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss