Fork me on GitHub
Nate Sutton00:12:40

is there a way to satisfy an interface like FilenameFilter without reify?


is there maybe a new way of doing this in Java in nio?

Nate Sutton00:12:48

I could always do the filtering in clojure instead of that way


it seems useful for babashka to be able to do this, so we can maybe hack a special case for reify and this class together... not sure, have to think about it

Nate Sutton00:12:33

in the meantime I can just filter clojure-side

Nate Sutton00:12:59

I don't know if in the use cases for babashka it really matters where we filter the filenames


I guess there are also other ways of filtering files? like with normal clojure functions?

Nate Sutton00:12:50

yeah, that's what I mean

Nate Sutton00:12:56

sorry, not explaining well


oh I see 🙂

Nate Sutton02:12:15

I'm not sure what I'm doing wrong here but this file exists:

user=> (java.nio.file.Paths/get "deps.edn")

Nate Sutton02:12:24

ahhh well that's odd

Nate Sutton02:12:25

user=> (java.nio.file.Paths/get "deps.edn" (make-array String 0))
#object[sun.nio.fs.UnixPath 0x23164e5e "deps.edn"]

Nate Sutton02:12:48

in the clojure repl I get this:

user=> (java.nio.file.Paths/get "deps.edn")
Execution error (ClassCastException) at user/eval9 (REPL:1).
class java.lang.String cannot be cast to class .URI (java.lang.String and .URI are in module java.base of loader 'bootstrap')

Nate Sutton02:12:16

and then in the clojure repl with two args I also get the same as in babashka

user=> (java.nio.file.Paths/get "deps.edn" (make-array String 0))
#object[sun.nio.fs.UnixPath 0x704b2127 "deps.edn"]


The ClassCastException may not be available in bb which is why you would get nil


I'll add it


$ bb '(shell/with-sh-env {:FOO "BAR"} (shell/sh "bash" "-c" "echo $FOO"))'
{:exit 0, :out "BAR\n", :err ""}

Nate Sutton11:12:30

yesss thanks!

Nate Sutton20:12:30

just fyi, btw, the --classpath option needs to be before the --repl option, not sure if that's as intended

Nate Sutton20:12:42

also the BABASHKA_CLASSPATH env var didn't seem to work with the repl


Babashka v0.0.56-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (io/resource "deps.edn")
#object[.URL 0x61932785 "file:/Users/borkdude/Dropbox/dev/clojure/carve/deps.edn"]


The order of the arguments is indicated by:

Usage: bb [ -i | -I ] [ -o | -O ] [ --stream ] [--verbose]
          [ ( --classpath | -cp ) <cp> ] [ ( --main | -m ) <main-namespace> ]
          ( -e <expression> | -f <file> | --repl | --socket-repl [<host>:]<port> )
          [ --uberscript <file> ] [ arg* ]


I don't want to be dependent on the rules of a tool for parsing options


Thanks. Yes can imagine. Although tools.cli is somewhat low level and without side effects, it still has made some decisions for you

Nate Sutton20:12:17

I wonder what I was seeing last night with the classpath env var

Nate Sutton20:12:20

I'll have to try again


you'll probably need to use export when you're running another script


Made a thing to cut out the unused vars from a project: Unleashing this on a script produced with --uberscript will make it even smaller.


(btw @lee it uses rewrite-cljc)


Coolio @borkdude! Has anybody ever mentioned you are whirlwind of productivity? I’ll be back to coding in the new year and drag rewrite-cljc through to an official release.


ok, let me know if you will remove the repo, so I can update my url/sha


but so far, it seems to work perfectly