This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-21
Channels
- # announcements (39)
- # architecture (7)
- # aws (9)
- # babashka (111)
- # beginners (139)
- # bristol-clojurians (1)
- # calva (47)
- # chlorine-clover (5)
- # cider (17)
- # clj-kondo (26)
- # clojars (25)
- # clojure (251)
- # clojure-berlin (1)
- # clojure-dev (5)
- # clojure-europe (22)
- # clojure-france (1)
- # clojure-hungary (6)
- # clojure-losangeles (8)
- # clojure-nl (18)
- # clojure-spec (3)
- # clojure-uk (68)
- # clojured (32)
- # clojurescript (32)
- # core-async (10)
- # core-typed (120)
- # cursive (8)
- # datascript (10)
- # datomic (11)
- # docker (2)
- # emacs (6)
- # figwheel-main (4)
- # fulcro (10)
- # graalvm (92)
- # hoplon (2)
- # instaparse (9)
- # jobs (3)
- # jobs-discuss (31)
- # joker (2)
- # kaocha (1)
- # lambdaisland (5)
- # leiningen (10)
- # luminus (1)
- # lumo (14)
- # meander (30)
- # mid-cities-meetup (1)
- # midje (1)
- # off-topic (46)
- # pathom (22)
- # perun (2)
- # re-frame (10)
- # reitit (1)
- # remote-jobs (8)
- # shadow-cljs (71)
- # spacemacs (7)
- # sql (40)
- # tools-deps (31)
- # tree-sitter (11)
- # vim (14)
- # vscode (2)
- # xtdb (5)
I've had some success developing bb scripts using a clojure workflow and then running them with bb.
I've seen inf-clojure
(a lightweight version of cider) mentioned in bb github, I'll try it to see how it goes
Yeah, I also use a normal clojure workflow with nrepl and then bb from the cli. It's generally not too hard to make everything compatible, since bb supports reader conditionals
I use babashka in my editor with a socket REPL and it is awesome
socket repl with inf-clojure
works well for evaluating expressions, however I can't seem to make auto-completion or documentation work
I think editor tooling providers may or may not have implemented it for several REPLs. you could drop a message in #emacs or #cider to ask about this for inf-clojure
If you want to check, it's exactly on these lines: https://github.com/mauricioszabo/repl-tooling/blob/master/src/repl_tooling/features/autocomplete/simple.cljs#L29-L45
Oh, I just saw that you posted on the channel already that you found 😄
"I'll also shout out some people in the community that came up many times - Sean Corfield for his tireless library work and help for beginners, Daniel Compton for his work with Clojurists Together (and his many other efforts), and Michiel Borkent for his work on scripting and tooling around graal, clj-kondo, sci, etc. Kudos to them, and to anyone else I missed in the responses!" https://insideclojure.org/2020/02/20/clojure-survey/
> For the next Clojure version (presumably 1.11), we plan to fix the Graal locking issue
There might be more cloned borkdudes. Or he never sleeps. Or theres a time machine involved. The sheer amount of good stuff that keeps coming from him forces me to think of these possibilities...
@U066U8JQJ You might be working on something?
@borkdude maybe in the future, currently just doing some experiments, but I'll let know if anything kicks off 🙂
I was able to setup inf-clojure
to have auto-complete (via company) and show the arguments of the function in eldoc:
(use-package inf-clojure
:ensure t
:config
(setq-default inf-clojure-repl-type 'clojure)
(setq inf-clojure-completion-form
"(clojure.core/let [collect (fn [x y] (clojure.core/map
(clojure.core/comp str first)
(x y)))
refers (collect clojure.core/ns-map *ns*)
from-ns (->> (clojure.core/ns-aliases *ns*)
(clojure.core/mapcat
(fn [[k v]]
(clojure.core/map (fn [x] (str k \"/\" x))
(collect clojure.core/ns-publics v)))))]
(clojure.core/->> refers
(concat from-ns)
(clojure.core/filter
(fn [x] (re-find #\"%s\" x)))
(clojure.core/sort)
))")
(setq inf-clojure-arglists-form
"(:arglists (meta (clojure.core/resolve (quote %s))))"))
Indeed. The only thing is that I haven't taken the time to really understand what the completion code does (I'm not familiar with the different ns
functions), it might be worth cleaning it up before putting on the readme
I have a feature request. Could we include java.time.temporal.ChronoUnit
in the included classes in classes.clj
? We have LocalDateTime
, LocalTime
, etc and I’m trying to calculate millis between two dates using (.until localDateTime otherDateTime ChronoUnit/MILLIS)
. If somebody has another way of calculating millis between two local date time instances without the CronoUnit requirement, any pointers would be much welcome.
I wonder how he did it, but since java.time.temporal.ChronoUnit seems to be something we want to include, I'm ok with that
@mbjarland PR welcome for the missing class
and just so I’ve said it, babahska is awesome and I have to say I’m quite impressed by the level of progress on this project
I just finished writing a jstack thread dump analyzer command line script using babashka, does transitive lock analysis and prints out a report with colored ascii trees and tons of stats etc…quite nice
thanks a lot! if there's any examples that we should link to from the README, I'd be happy to include it
or if it's something that's useful in general, you can PR it into the examples
directory of the repo with a small description in the README in the Gallery section
hmm…I’ll have to mull that over. Code written in the context of a client project, need to meditate on what I can and can not share
Hello. Mostly for learning proposes, how do I debug this:
$ cat deps.edn
{:deps {com.cognitect.aws/api {:mvn/version "0.8.437"}
com.cognitect.aws/endpoints {:mvn/version "1.1.11.722"}
com.cognitect.aws/s3 {:mvn/version "784.2.593.0"}}}
$ CLASSPATH="$(clojure -Spath)"
$ rlwrap bb --classpath "$CLASSPATH" --repl
Babashka v0.0.71 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (require '[cognitect.aws.client.api :as aws])
No matching clause: :use [at cognitect/aws/client/api.clj, line 4, column 1]
This line/column don't look right.@souenzzo babashka honors the BABASHKA_CLASSPATH
env variable. it's unlikely that aws.client.api works out of the box with babashka, since it's quite a complex project. it doesn't even compile with GraalVM itself 🙂
Yeah sure. But my point is more about "how to debug/find limitations" or "why it say about this line" (this line is a (ns ...
line
libs that do work with babashka are listed here: https://github.com/borkdude/babashka/#tools-and-libraries
JUXT wrote a blog post about babashka! https://juxt.pro/blog/posts/babashka.html
yeah, I also discovered that later on. one other difference with for is that doseq accepts multiple exprs, like when
@mbjarland I added a unit test in this PR for your PR: https://github.com/mbjarland/babashka/pull/1/files
sci as a slack bot using a google cloud function: https://twitter.com/borkdude/status/1230886396551929857
That article from JUXT gets me thinking - make
is cool, but Makefile
's are fiddly and arcane. Anybody ever think of using babashka to transform an edn file to a makefile?
Sounds like a good idea!
@borkdude I tried using when-some
in a bb script and noticed it didn't exist. Would that only involve a change to sci? I found where when-let
is defined.
A change in Sci and then a submodule update in Babashka. But it starts with a commit in Sci
I guess you only need to add when-some
here https://github.com/borkdude/sci/blob/cdca1bc28b071163333b6c352430cec544c3c5ae/src/sci/impl/namespaces.cljc#L141-L153 Then it would be automatically included. For normal functions it works slightly different
@nate jeroen is right, it should be implemented right there along with the others. PR welcome!
the clojure.data.xml branch has been made up to date. in a few minutes there will be binaries to test out in #babashka_circleci_builds
at least this works on my machine:
$ ./bb '(clojure.data.xml/parse-str "<foo></foo>")'
#xml/element{:tag :foo}
$ ./bb '(clojure.data.xml/emit-str (clojure.data.xml/parse-str "<foo></foo>"))'
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo/>"
not all of the API functions are in there yet, if you need more than feel free to add more to the branch
I'm trying a file watcher with Graalvm (maybe useful for babashka too). Any idea how to solve an error like this?
Exception in thread "main" java.lang.IllegalArgumentException: Class java.nio.file.StandardWatchEventKinds$StdWatchEventKind[] is instantiated reflectively but was never registered. Register the class by using org.graalvm.nativeimage.hosted.RuntimeReflection
at com.oracle.svm.core.genscavenge.graal.AllocationSnippets.checkArrayHub(AllocationSnippets.java:182)
at clojure.lang.RT.seqToTypedArray(RT.java:1753)
at clojure.core$into_array.invokeStatic(core.clj:3454)
at clojure.core$into_array.invoke(core.clj:3443)
at juxt.dirwatch$register_path.invokeStatic(dirwatch.clj:38)
I've tried adding several variations of adding java.nio.file.StandardWatchEventKinds$StdWatchEventKind[]
to the reflection file without successIt's this library https://github.com/juxt/dirwatch
The above is the output of the native image btw
Not sure but this is the definition (a private class)
private static class StdWatchEventKind<T> implements WatchEvent.Kind<T> {
84 private final String name;
85 private final Class<T> type;
86 StdWatchEventKind(String name, Class<T> type) {
87 this.name = name;
88 this.type = type;
89 }
90 @Override public String name() { return name; }
91 @Override public Class<T> type() { return type; }
92 @Override public String toString() { return name; }
93 }
@jeroenvandijk I think I would check that lib for reflection warnings, that's probably causing this
Yeah i think you are right
Thank you 🙂
@jeroenvandijk we already have some functions around waiting for things here: https://github.com/borkdude/babashka/#babashkawait it doesn't use a file watcher, it's just polling
I want to have a webserver with live reload like functionality. I hope that this library will help me with that. Let's see if I can get rid of the warnings
Ok compiles runs now. Not the results I expect yet. Maybe something internally goes wrong