Fork me on GitHub
#babashka
<
2019-11-12
>
Jakub Holý (HolyJak)16:11:59

Hello! I see file-seq isn't supported, right?

borkdude16:11:44

let's see...

borkdude16:11:11

apparently not, but I don't see why not. if you like you can make a PR, or I'll do it

Jakub Holý (HolyJak)16:11:08

Btw I need to replace a string in a file. I guess the simplest way is to just call sed from babashka (I don't want to read the whole file in memory, and the string is in the first few lines)

borkdude21:11:40

@holyjak Added it. Do you need a new binary, for which OS?

❤️ 4
borkdude21:11:14

$ bb '(map #(.getPath %) (file-seq (io/file "src")))' | bb '(take 3 *in*)'
("src" "src/babashka" "src/babashka/impl")

Jakub Holý (HolyJak)21:11:12

FYI I am trying to run a file / send a defn to bb socket repl and I get not very useful

java.lang.IllegalArgumentException: "Don't know how to create ISeq from: clojure.lang.Symbol"
...
in clojure.core/second--5392 (core.clj:96)
in sci.impl.analyzer/expand-fn-args+body (analyzer.cljc:88)
...
Now I send a defn to the REPL so I know which part of the file caused it, when I run the whole file with bb -f ... then I had no indication of the location. If possible, it would be very helpful to get better error message and with location in the source file.

borkdude21:11:42

if you can be more specific about the input and output, I'm able to help

borkdude21:11:20

normally it tries to also include the location, but there might be places where it slips through

borkdude21:11:43

I think I have reproduced the error for you:

$ bb '(defn foo (foo)) (foo 1)'

borkdude21:11:55

I'll make an issue for it.

Jakub Holý (HolyJak)21:11:28

This is BTW the code that fails, because I unfortunately shadow fn but SCI doesn't get that:

(defn i-fail [fn] (fn 123))

borkdude21:11:50

Added it to the issue

borkdude21:11:38

I fixed a similar thing before once:

$ bb '(defn foo [defmacro] defmacro) (foo 1)'
1
I wonder why fn is treated specially here, but I'll find out

borkdude21:11:17

aah, it has the same bug when you use the argument as a function call still 🙂

borkdude21:11:02

thanks for reporting, this will get fixed soon

Jakub Holý (HolyJak)21:11:22

Thanks to you for the great work!!!