i use babashka.fs for a bunch of stuff, and it works with java.nio.file.Path a bunch instead of with strings. that's fine, except when i try to use Path with the clojure standard library, like slurp, it throws an error that it can't open the path as an InputStream. would it be possible to extend slurp to accept paths and not just strings?
it looks like slurp just delegates to https://clojuredocs.org/clojure.java.io/reader, which already accepts Files, so maybe it could accept Paths too?
this is a gap in http://clojure.java.io - there's open issues for it
you can use fs/file to convert a path to a file so clojure knows how to deal with it
gotcha, ty. i've been using str just so the error handling is all in one place
gosh that's an old ticket
You can upvote
vote on the Ask
once they started the Ask site, they closed the jira to public voting/discussion and created an Ask question for each open jira ticket. all voting and discussion now happens on that associated Ask
fascinating
is the ask linked somewhere on the jira ticket? I don't see it
oh i see it's the link you originally posted
lol sorry, it's the clojure q/a site, at "http://ask.clojure.org", so we call the questions Asks
it's for both general clojure-related questions and for bug reports/feature requests
what's the idiomatic way to write (do (f) nil)? i.e. discard the return value
Just throwing for fun (let [_ (f)])
if there's gonna be golfing it, then (if (f)) is smaller than when
I would also prefer (do (f) nil) for clarity though.
do like that is fine, it really depends on your goal, there often isn't a reason to "discard" the value at all
Using constantly is something that is slept on sometimes, like ((constantly nil) ...) but here the do is clearer
You can get really cute with constantly https://gist.github.com/hiredman/5644dd40f2621b0a783a3231ea29ff1a#file-yield-clj-L30
I'd definitely use (do ...), with a comment on why the value gets discarded.
in this case it was so that (defexpect) wouldn't try to treat it as an assertion
How can (when (f)) return false?
I stand corrected