This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-05
Channels
- # adventofcode (50)
- # announcements (1)
- # asami (29)
- # babashka (56)
- # beginners (19)
- # calva (62)
- # cider (12)
- # cljs-dev (1)
- # clojure (42)
- # clojure-europe (214)
- # clojure-france (4)
- # clojure-italy (1)
- # clojurescript (58)
- # community-development (4)
- # cryogen (6)
- # cursive (7)
- # data-science (1)
- # events (3)
- # figwheel-main (1)
- # fulcro (21)
- # lambdaisland (3)
- # malli (17)
- # mid-cities-meetup (1)
- # off-topic (38)
- # pathom (3)
- # reagent (7)
- # reclojure (1)
- # reveal (15)
- # rewrite-clj (11)
- # shadow-cljs (30)
- # sql (21)
- # test-check (14)
- # tools-deps (1)
- # vim (21)
- # xtdb (5)
I could use edamame.core/parse-string
in bb. Any chance we can include this in the clojure.edn NS? Or is there another way to include this?
@kevin.van.rooijen you can use read-string
in bb as well
currently read-string is a bit under-developed. but read-eval is turned off by default in edamame
you could post an issue about what you expect to work, but I expect read-string to be safe by default in bb currently
edamame currently doesn't even support this, nobody has ever asked for this before. edamame just returns (read-eval (+ 1 2 3))
when you pass :read-eval true
but doesn't have a callback for evaluating it, which we of course can include
1) The first step would be to fix edamame to support a read-eval function which gets the expression and then can eval it
2) Fix read-string in bb or sci (not sure where it is currently). I think in the case of sci it could make sense to disallow it by default unless someone passes a setting. In bb we can enable this setting by default.
But doesn't it just crash, like in clj? https://clojuredocs.org/clojure.core/*read-eval*#example-542692d1c026201cdc326f3a
Currently I just want to get all the functions in a namespace, without having to require it
I think clj-kondo is a much better tool for this.
$ clj-kondo --config '{:output {:analysis true :format :edn}}' --lint - <<< '(defn foo [])' | puget
{:analysis {:namespace-definitions [],
:namespace-usages [],
:var-definitions [{:col 1,
:filename "<stdin>",
:fixed-arities #{0},
:name foo,
:ns user,
:row 1}],
:var-usages [{:arity 2,
:col 2,
:filename "<stdin>",
:from user,
:macro true,
:name defn,
:row 1,
:to clojure.core,
:varargs-min-arity 2}]},
:findings [],
:summary {:duration 35,
:error 0,
:files 1,
:info 0,
:type :summary,
:warning 0}}
@kevin.van.rooijen if you're using this from emacs, you might also want to look at anakondo: https://github.com/didibus/anakondo
Private functions can't be called in bb? Trying to figure out what this function results in (#'babashka.curl/curl-command {})
that function just isn't exposed in the bb sci config (if you have watched the internals talk, you will know what I mean)
@kevin.van.rooijen if you want to see the command, you can also do (:command (curl/get "foobar" {:debug true}))
$ bb -e "(:command (curl/get \"\" {:debug true}))"
["curl" "--silent" "--show-error" "--location" "--dump-header" "/var/folders/2m/h3cvrr1x4296p315vbk7m32c0000gp/T/babashka.curl8448783184890828476.headers" "--compressed" ""]
That might be better, I haven't used it that way yet. But Cookie is just an HTTP header, so something like this should also work:
$ bb -e '(org.httpkit.server/run-server (fn [req] (clojure.pprint/pprint req) {:body "hello"}) {:port 3000}) (curl/post "" {:headers {"Cookie" "name=dude; foo=bar"}}) nil'
{:remote-addr "0:0:0:0:0:0:0:1",
:headers
{"accept" "*/*",
"accept-encoding" "deflate, gzip",
"cookie" "name=dude; foo=bar",
"host" "localhost:3000",