[plt-scheme] dumb script question
On Nov 24, Michael Vanier wrote:
>
> Great stuff, but all I want is (current-program-name) :-( Consider
> this a feature request.
That doesn't make sense since the `program' is one of several
files... A `(current-load-file)' would make more sense, and be
similar to the `(current-load-relative-directory)', but that will also
be a little bogus if you happen to load more than a single file.
I think that the best approach to this is exactly the same as
`this-expression-source-directory'. Something like this seems
reasonable:
(define-syntax (this-expression-file-name stx)
(syntax-case stx ()
[(_)
(let* ([f (syntax-source stx)]
[f (and f (string? f) (file-exists? f)
(let-values ([(base file dir?) (split-path f)]) file))])
(datum->syntax-object (quote-syntax here) f stx))]))
so it might be a good idea to add it to "etc.ss" --? (Please tell me
if it makes sense and I'll add it.)
(The only problem now is that the syntax-source is "STDIN" for
interactive input, but seems like in v299 it changed to 'stdin
instead.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!