[plt-scheme] Current line number

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Mon Jan 18 16:07:25 EST 2010

On Mon, Jan 18, 2010 at 9:01 PM, Eli Barzilay <eli at barzilay.org> wrote:
> Try this:
>
>  (define-syntax (show-here stx)
>    (with-syntax ([src  (format "~a" (syntax-source stx))]
>                  [line (syntax-line stx)]
>                  [col  (syntax-column stx)]
>                  [pos1 (syntax-position stx)]
>                  [pos2 (+ (syntax-position stx) (syntax-span stx))])
>      #'(printf ">>> ~a:~a:~a ~a-~a\n" src line col pos1 pos2)))
>
> (There's also `this-expression-source-directory',
> `this-expression-file-name', and a bunch of other utilities around.)
>

Excellent, thanks a lot!

-- 
Paulo Jorge Matos - pocmatos at gmail.com
http://www.pmatos.net


Posted on the users mailing list.