Fork me on GitHub
#babashka
<
2020-01-21
>
borkdude14:01:31

I ended up incorporating data.csv into babashka at some point (when it wasn't possible to run libs yet), but I just discovered that we've been using clojure-csv at work for a few years now. Not sure why one would prefer one over the other. Something around csv seems convenient to have in a scripting tool, but I could also remove data.csv as a built-in and add support to be able to run either library as an interpreted/optional lib. Any opinions? (cc @plexus)

sogaiu14:01:49

run as optional lib sounds good to me - especially if you are unsure about inclusion. no idea about who might be already using it though.

sogaiu14:01:57

if going the optional route, might be nice for folks to have a clear specific example for migration.

borkdude14:01:24

The issue with clojure.data.csv is that it uses defprotocol which is not (yet) supported in bb, so it can't be an interpreted lib. Same thing with cheshire and clojure.data.json

borkdude14:01:37

Maybe for now it's just a nice bonus that you can use clojure-csv as a lib

sogaiu15:01:50

ah - so defprotocol is something that you are hammocking about then?

sogaiu15:01:32

the docs and test look good to me :thumbsup:

borkdude15:01:35

defmethod is first on the list. I would likely just translate defprotocols to defmethod-like functionality

borkdude15:01:17

assuming that's possible, not sure, I didn't do any work on this yet

borkdude15:01:04

I agree that it's convenient, but since I'm not a hard-core user of data.csv vs clojure-csv, it's hard to make informed choices there. but the difference doesn't seem that big to make a big deal out of it

sogaiu15:01:19

i am not so sure about inclusion of core libs "because x was a core lib"

sogaiu15:01:45

sorry mobile 🙂

sogaiu15:01:06

i think there are some things that jvm clojure in retrospect would prefer not to have had bundled

sogaiu15:01:32

at any rate, if it turns out x is actually used widely, then i think that might count as a significant factor toward inclusion

borkdude15:01:33

right. I've chosen cheshire over data.json, because it seems to be the defacto lib in the community (although that may still be a subjective judgement)

sogaiu15:01:37

just my 2 cents 🙂

borkdude14:01:53

fwiw it's now possible to run clojure-csv as a library with bb on master (see #babashka_circleci_builds for downloads):

borkdude@MBP2019 ~ $ export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {clojure-csv {:mvn/version "RELEASE"}}}' -Spath)"
borkdude@MBP2019 ~ $ rlwrap clojure -A:bb-local
user=> (require '[clojure-csv.core :as csv])
nil
user=> (csv/write-csv (csv/parse-csv "a,b,c\n1,2,3"))
"a,b,c\n1,2,3\n"
user=>