[plt-scheme] problem with example macro

From: michael rice (nowgate at yahoo.com)
Date: Wed Nov 22 10:37:52 EST 2006

Noticed this about the first macro given in
"Syntax-rules Primer for the Merely Eccentric" in the
Macro section of schematics:cookbook.

Hope it's not something I'm doing wrong.


(define-syntax nth-value
  (syntax-rules ()
    ((nth-value n values-producing-form)
       (lambda () values-producing-form)
       (lambda all-values
         (list-ref all-values n))))))


Welcome to DrScheme, version 360.
Language: Swindle.
> (nth-value 3 '(a b c d e f))
. list-ref: index 3 too large for list: ((a b c d e

Sponsored Link

Online or Campus degree Associate's, Bachelor's, or Master's
in less than one year.www.findtherightschool.com

Posted on the users mailing list.