ah - thanks. I think I didn't actually have a file for information to be about.
so this much is easy, but I don't know how to make it first class.
(define-syntax car+
(lambda (o)
(syntax-case o ()
((_ e)
#`(let ((p e))
(if (pair? p) (car p)
(error 'car+ "not a pair" p #'#,o)))))))
If I add a catch-all pattern to the syntax-case, I could return a
procedure that calls car+ in the body, but the syntax information
won't match the call site of the created procedure (it will match the
call to car+ in its body).
On Fri, May 1, 2009 at 6:10 PM, Abdulaziz Ghuloum <[email protected]> wrote:
>
> On May 1, 2009, at 10:55 AM, Ramana Kumar wrote:
>
>> If I print a syntax object, I don't see any source file information.
>
> Hmmm.
>
> $ cat /tmp/test.ss
> #!r6rs
> (import (rnrs))
> (display #'foo)
> (newline)
> (display #'(bar baz))
> (newline)
>
> $ ikarus --r6rs-script /tmp/test.ss
> #<syntax foo [char 35 of /tmp/test.ss]>
> #<syntax (bar baz) [char 61 of /tmp/test.ss]>
>
> $ ikarus /tmp/test.ss
> Ikarus Scheme version 0.0.4-rc1+ (revision 1770, build 2009-04-27)
> Copyright (c) 2006-2009 Abdulaziz Ghuloum
>
> #<syntax foo [char 35 of /tmp/test.ss]>
> #<syntax (bar baz) [char 61 of /tmp/test.ss]>
>>
>
> Aziz,,,
>