This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-02
Channels
- # ai (1)
- # aleph (16)
- # announcements (1)
- # architecture (51)
- # babashka (32)
- # beginners (27)
- # calva (3)
- # clerk (1)
- # clojure (49)
- # clojure-art (1)
- # clojure-denver (6)
- # clojure-europe (70)
- # clojure-nl (1)
- # clojure-norway (56)
- # clojure-uk (2)
- # clojuredesign-podcast (4)
- # clojurescript (57)
- # clr (15)
- # community-development (3)
- # conjure (1)
- # core-async (10)
- # data-science (1)
- # datalog (2)
- # datomic (3)
- # emacs (12)
- # events (1)
- # gratitude (4)
- # honeysql (9)
- # hyperfiddle (86)
- # jobs (4)
- # off-topic (10)
- # pedestal (5)
- # portal (11)
- # practicalli (2)
- # reitit (7)
- # releases (3)
- # remote-jobs (1)
- # sql (15)
- # tools-build (8)
- # xtdb (4)
Would it be useful to have gzip and gunzip functions in the babashka.fs library, like the existing zip and unzip functions? I can create an issue and a pull request to add these functions if youβre interested. Thanks for considering it!
I just used io/copy
and GZIPInputStream
, but a simple fs/(un)gzip
might be useful to fill out the api
Great, here is the pr: https://github.com/babashka/fs/pull/103
made a little something with babashka today π
https://github.com/somecho/utility-scripts#depo
It's a util to add dependencies to a clojure project e.g. depo add reagent
Even though I already use Neil and https://github.com/teodorlu/neil-quickadd for dependencies already, I found it really interesting to read your code. It's so readable and straightforward! I didn't expect that neil dep add
could be implemented in one page of code.
(Though Neil supports finding dependencies on other places than Clojars)
@U059WGT3F7C You can specify --deps-file
@U04V15CAJ will project.clj
files work too?
@U059WGT3F7C currently not
I do have this slightly related util: https://github.com/borkdude/lein2deps, but it only works one way
hi, I have code like below
(let [span-attributes {:some-key "some-value"}]
(telemetry/with-span "SPAN_NAME" span-attributes
(... some block of code)))
I wish to create a list of all keys in the attributes passed to with-span
. I would like to do this at build time. I tried grasp and using it I could get the span-attributes
, but how do I resolve that binding to its value, ie the actual hash-map? Should I be using some other tool instead of grasp?you could combine this with #clj-kondo :locals analysis: https://github.com/clj-kondo/clj-kondo/blob/master/analysis/README.md
so find all the callsites of with-span (you can also do this with clj-kondo) and then find the local as argument and then find the local-definition, then read the expression at the location of the local-definition (e.g. using rewrite-clj or edamame, etc)
Interesting. This gives me something to explore. I will likely have doubts on how to do > then find the local-definition, then read the expression at the location of the local-definition but let me try on my own first. Thanks!
Using the clj-kondo analysis I found the location of the local definition.
{:end-row 794,
:scope-end-row 876,
:name span-attrs,
:scope-end-col 55,
:filename "src/some-path.clj",
:str "span-attrs",
:col 9,
:id 287,
:end-col 19,
:row 794}
However how do I read the expression using edamame and the above info? Reading the edamame docs and experimenting with it, I am not sure how to get to line number 794 or read the expression hashmap there.@U0A5B1LJU It's probably best to use rewrite-clj and write a loop like this: https://github.com/borkdude/carve/blob/cb621317ae1582869c8bd8f1a47cf57a3598d803/src/carve/impl.clj#L124 Just parse top level expressions until you find the one with the right row + end-row and then search for the sub-expression with the right location and then stringify that
> Just parse top level expressions until you find the one with the right row + end-row and then search for the sub-expression with the right location and then stringify that
thank you for this algorithm. I managed to write some hardcoded code using rewrite-clj that gave the expected answer. now to refine it further.
with edamame, I couldn't figure out how to get the end-line number. with rewrite-clj, their position-span
function helped a lot.
I did check the meta. In the readme, it shows the start and end line numbers. However, when I was trying it, I was only getting a line number. I must have been doing something wrong Will check it later.
user=> (require '[edamame.core :as e])
nil
user=> (meta (e/parse-string "foo"))
{:row 1, :col 1, :end-row 1, :end-col 4}
You are right. I misunderstood this as a recommended set of options
{:all true
:row-key :line
:col-key :column
:end-location false
:location? seq?}
with this I was getting only the start line number and column π My bad for misreading the docs. Thanks!Babashka news of May 2023! https://github.com/babashka/babashka/blob/master/doc/news.md#2023-05-twitter-mastodon

