[plt-scheme] getting argument identifiers

From: Stephen De Gabrielle (spdegabrielle at gmail.com)
Date: Fri Oct 17 06:12:08 EDT 2008

Hi,

I was wondering if there is a way of defining a function or macro that
could get the identifiers for the arguments it is passed,

> (define x 2)
> (print-identifier-and-value x)
x:2
>

Please forgive me if this is the dumb question I suspect it is.

What I  was trying to do was define a macro that would dump whatever I
stuffed into it. (instead of using printf functions all through my
code)
It can get unwieldy so I wanted to print the identifiers too.

 (define-syntax dump-all
  (syntax-rules ()
    [(_ x ...)
     (begin
       (printf "Dump:~N")
       (for-each
         (lambda (i) (printf "item:~n~v~n" i))
         (list x ...))
       (printf "Dump End~n")
       )]))

(define x "dfd")
(dump-all 2 4 x)


Cheers,

Stephen


Posted on the users mailing list.