
I looked at all the filename/path functions, but cant seem to find a good way to get the basename of a file. any suggestions?

@joelmccracken Btw - I think I got an idea about the problem yesterday.

oh cool

If you add an @(require "set-globals.rkt")
to you pm-file, then you will run the setters at the right time.

Maybe file-name-from-path
?

Idk that sounds like it would have the same issue

beign in a different “environment” from the main script, build.rkt

Could be.

@joelmccracken By “basename” you mean name.ext
or just name
in /path/to/name.ext
?


To get name
from that, I think just do https://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._path-replace-extension%29%29 with a blank #""
extension?

p.s. These all will work with C:\path\to\name.ext
as well.

I am familiar with Clojure style macros (a macro is a function that takes sexp as input, produces sexp as output, and often uses lots of quasiquote / unquote).
I am interested in learning Racket style “hygienic” macros. Is there a good resource that focuses on walking me through lots of examples (as opposed to explaining lots of theory) ?




@githree: Thanks!

sorry @greg I was def incorrect, i thought unix basename
returned foo
out of basename baz/foo.tar.gz
, but it actually returns foo.tar.gz

i meant that I just wanted foo
. I actually hacked around it by doing (first (string-split filename "."))

context is that i was hoping to get my-post
out of <http://my-post.html.pm\|my-post.html.pm>

so using replace-extension
i’d have to apply it repeatedly until it comes to a fixed point

(which sounded worse to me)

I guess i was thinking that maybe there could be a package out there that I just don’t know about that adds all kinds of niceties to do this kind of thing

(i’m still pretty new to Racket, so I apologize to everyone for the repeated “how do I do x?” queries, lol)

just saw the function ~a
, good idea

oh ok, cool

I have question about scope of let-syntax
. I wanted to eval
a quoted sexp inside a let-syntax
, but it didn’t work. I solved it by moving the syntax definition into a top level define-syntax
. The goal was to take the output of a lang brag
parser and expand the resulting quoted sexp using some syntax defined in the let-syntax
. The point of using the let-syntax
was so that the syntax could be parameterized by the enclosing function’s arguments. Maybe eval
was the wrong tool? Or am I trying to do something peculiar?

To clarify I had expected let-syntax
to add its bindings to current-namespace
, but it didn’t. I am guessing I don’t quite understand how namespaces work with let
type bindings.

@carl.morris.world Sounds like a job for local-expand
.