This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-01
Channels
- # announcements (3)
- # aws (1)
- # babashka (56)
- # beginners (42)
- # calva (9)
- # cider (6)
- # circleci (5)
- # clj-kondo (17)
- # cljs-experience (1)
- # cljsjs (2)
- # clojure (106)
- # clojure-australia (1)
- # clojure-europe (36)
- # clojure-germany (5)
- # clojure-italy (13)
- # clojure-nl (14)
- # clojure-spec (19)
- # clojure-uk (27)
- # clojurescript (27)
- # cursive (20)
- # datomic (24)
- # events (2)
- # fulcro (11)
- # graalvm (1)
- # jobs (6)
- # lsp (6)
- # malli (5)
- # meander (36)
- # membrane (17)
- # nbb (4)
- # nextjournal (86)
- # off-topic (18)
- # pathom (3)
- # polylith (5)
- # portal (14)
- # rdf (5)
- # re-frame (5)
- # releases (6)
- # remote-jobs (3)
- # reveal (2)
- # ring (6)
- # shadow-cljs (139)
- # tools-deps (61)
- # vim (10)
- # xtdb (6)
can you tell more? there is a clojure library: https://github.com/edma2/clojure-msgpack but I'm not sure how well it works and it won't be that fast when converting loads of data
the potential use case is to provide data for a csharp program that uses msgpack. Now I'm thinking json will do. It it some non critical code path
for fun, I will add the necessary classes for https://github.com/edma2/clojure-msgpack, to see if it works for you, if it doesn't you can fall back to JSON anyway
Could you test with this linux one? https://25888-201467090-gh.circle-artifacts.com/0/release/babashka-0.7.5-SNAPSHOT-linux-amd64-static.tar.gz And the https://github.com/edma2/clojure-msgpack library. Windows binary still building in CI.
(require '[msgpack.core :as msg])
(require 'msgpack.clojure-extensions)
(assert (msg/pack {:compact true :schema 0}))
; => #<byte[] [[email protected]>
(assert (:compact (msg/unpack (msg/pack {:compact true :schema 0}))))
; => {:schema 0, :compact true}
works@U02CV2P4J6S Windows binary: https://ci.appveyor.com/api/buildjobs/j6gd482myt9b662r/artifacts/babashka-0.7.5-SNAPSHOT-windows-amd64.zip
I can say I use it for my thingy now. Beyond that I don't know what the tradeoffs are
at first glance it does. I guess I can try with testcheck or something. Isn't there something that makes arbitrary objects?
you can always get the latest master build from https://github.com/babashka/babashka-dev-builds
jo borkdude now I'm trying on windows ends up
wait maybe I'm lying
ok yea I can confirm 0.7.5 worksjava.io.DataInput
is missing there still. Version 0.7.5. Sorry for the late followup.
Hey, I want to use babashka like python for some scientific calculations and plotting. I am very familiar with matplotlib for python. Can I use libpython-clj with babashka? Is there some other way to generate plots with babashka? All I see is for viewing plots in the browser with things like hanami or oz. But I really prefer images for org-babel or even publishing.
@U01LR7M2B7A has done some cool stuff with org-babel and babashka.
you might have more luck with #nbb - there you can use any Node.js library which may have some good plotting libraries
or build a Python pod around plotting. https://github.com/babashka/pods/blob/master/examples/pod-lispyclouds-sqlite/pod-lispyclouds-sqlite.py
Is there a way to put something on the systemโs clipboard from bb? A way to create a classpath or java command and have the person have access to that rather than managing the process directly in bb?
Whenever I need to do this I shell out to a system utility, like pbcopy on osx for example.
You could shell out to a python script with pyperclip to get cross-OS clipboard compatability.
I lazy load dependencies like this:
(defn can-do? [program] (= 0 (:exit (sh "command" "-v" program))))
(defn install-or-noop [program install-fn]
(when-not (can-do? program)
(println (<< "You don't have {{program}} installed. Installing now..."))
(install-fn)
(println (<< "{{program}} should be installed now. Thanks!"))))
@U11BV7MTK I could see if that java.awt clipboard thing works with bb, without adding too much binary size... What was the invocation again?
i am asking because i might do some scripting in the future. No need quite yet. And no idea how many others would find it useful
Something like this, but those awt classes aren't in bb yet: https://gist.github.com/exupero/1462ec16d8874dee9ee710257eaf3d3c I think with bb you could just shell out to pbcopy on mac, e.g.
@(babashka.process/process ["pbcopy"] {:in "dude"})
i can make my own local scripts, but if anyone on windows wanted to share they are out of luck conceptually
yeah, that's where the .awt thing comes in, or you could dispatch on OS name to do the most likely thing
Ah, there is: https://superuser.com/a/472601
There is a predicate in babashka.core
named windows?
which only returns true on Windows
some linuxes also have xclip
so to be fully portable you could check with fs/which
which one is available on which OS
btw, I tried getting awt clipboard stuff into bb but it's not playing so well with graalvm (and adds binary size), so I think dispatching on os + finding the appropriate binary would still be best
That's so nice that you checked. Thanks @U04V15CAJ
if you use osc52 enabled terminal like xterm, windows terminal, mintty, etc. you can use https://chromium.googlesource.com/apps/libapps/+/HEAD/hterm/etc/osc52.sh, should be straight forward to port it to pure bb.