Fork me on GitHub
#babashka
<
2021-07-24
>
lispyclouds06:07:19

@yubrshen do you mean using the PI value, abs and cosine functions? If yes, using the (Math/abs n), (Math/cos n) and (Math/PI) work in bb. They are from the standard java library

👍 6
yubrshen16:07:24

Yes. Thanks. What's the :deps expression in deps.edn and in (:require ) expression to use Math namespace for Clojure, as I have to use Clojure with Cider/Emacs/Repl tool chain to do the development, and tests. By the way, using clojure.algo.generic also worked.

lispyclouds06:07:23

Math is imported directly as its part of java.lang and all are imported for you. Can directly use (Math/func ...)

lispyclouds06:07:10

Also its a java class and for java classes which are not automatically imported you need to use https://clojuredocs.org/clojure.core/import

nha09:07:31

Playing with process again today, not sure why/how, I am getting this error (only in CI, seen with bb 0.4.6 and 0.5.0). Seems like this line https://github.com/babashka/process/blob/4fdf33c0243ff646dfa91c4454844a33e0f025b0/src/babashka/process.clj#L233 and then going into the clj source’s own multimethod https://github.com/clojure/clojure/blob/b1b88dd25373a86e41310a525a21b497799dbbf2/src/clj/clojure/java/io.clj#L406 Not reproducing locally yet so a bit puzzled, putting it here in case someone has an idea

#error {
   :cause No method in multimethod 'do-copy' for dispatch value: [java.lang.ProcessImpl$ProcessPipeInputStream sci.impl.fns$fun$arity_1__1213]
   :via
   [{:type java.util.concurrent.ExecutionException
     :message java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: No method in multimethod 'do-copy' for dispatch value: [java.lang.ProcessImpl$ProcessPipeInputStream sci.impl.fns$fun$arity_1__1213]
     :at [java.util.concurrent.FutureTask report FutureTask.java 122]}
    {:type java.util.concurrent.ExecutionException
     :message java.lang.IllegalArgumentException: No method in multimethod 'do-copy' for dispatch value: [java.lang.ProcessImpl$ProcessPipeInputStream sci.impl.fns$fun$arity_1__1213]
     :at [java.util.concurrent.FutureTask report FutureTask.java 122]}
    {:type java.lang.IllegalArgumentException
     :message No method in multimethod 'do-copy' for dispatch value: [java.lang.ProcessImpl$ProcessPipeInputStream sci.impl.fns$fun$arity_1__1213]
     :at [clojure.lang.MultiFn getFn MultiFn.java 156]}]
   :trace
   [[clojure.lang.MultiFn getFn MultiFn.java 156]
    [clojure.lang.MultiFn invoke MultiFn.java 238]
    [$copy invokeStatic io.clj 406]
    [babashka.process$copy invokeStatic process.clj 197]
    [babashka.process$process$fn__28497 invoke process.clj 233]
    [clojure.core$binding_conveyor_fn$fn__5773 invoke core.clj 2034]
    [clojure.lang.AFn call AFn.java 18]
    [java.util.concurrent.FutureTask run FutureTask.java 264]
    [java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1128]
    [java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 628]
    [java.lang.Thread run Thread.java 829]
    [com.oracle.svm.core.thread.JavaThreads threadStartRoutine JavaThreads.java 553]
    [com.oracle.svm.core.posix.thread.PosixJavaThreads pthreadStartRoutine PosixJavaThreads.java 192]]}

borkdude09:07:52

@nha With a repro I would be better able to help you. The copy comes from io/copy which is implemented using a multimethod in

3
nha11:07:40

gah.. it’ user error after all 😕

(-> (process '[echo "something"]
             {:out (fn [_]
                     ;; ...
                     )})
    (check))

nha11:07:02

for context, I am making a my-process fn that accepts functions but was calling babshka.process/process instead facepalm

👍 3
michael zhou14:07:20

Hello, anyone can help me with this? I want to use fxl to handle excel files. Seems like bb doesn’t support this library.

borkdude14:07:19

@zhoumin79 hi! bb only supports libraries that are based on the standard clojure + Java libraries (or built-in libraries) so unfortunately you can't load this excel library from source

borkdude14:07:46

@zhoumin79 a workaround is e.g. installing csvkit which I think supports transforming an excel to csv and vice versa

borkdude14:07:07

another approach could be to build an excel pod but this is more work

michael zhou15:07:49

@borkdude thanks. BB is a great tool for automating work. CSV does work. I have used it. But I have many sheets with releations in one excel file. I want to use bb script to do with them. Could you create a Fxl pod later? Fxl is also a nice library to deal with excel data.

borkdude15:07:05

Ah, I didn't know this library, but it's worth a look. Could you post a "discussion" about this on the Github Discussion board under Ideas?

michael zhou15:07:23

Ok, I will post a dicussion. Thank you very much.

borkdude15:07:46

@zhoumin79 what I meant before is that it's currently an option to use https://csvkit.readthedocs.io/en/latest/scripts/in2csv.html to convert an excel sheet to CSV and then do the processing in bb

borkdude15:07:06

but I understand that directly working with excel sheets is more pleasant

michael zhou15:07:17

yes. I use bb script with [clojure.data.csv :as csv] to work with csv. It works great. But Excel with many sheets is more useful. Thanks.