Fork me on GitHub
#clojure
<
2022-02-03
>
hiredman00:02:30

how are you running your tests?

hiredman00:02:45

https://github.com/cognitect-labs/test-runner for example calls shutdown-agents! already

1
respatialized00:02:47

I am using this library, but I experienced test suites that failed to exit not too long ago and adding an explicit call to shutdown-agents! in my own test fixture seemed to fix it. perhaps that was a coincidence?

hiredman00:02:33

yes, you also may have just broken your test suite generally

hiredman00:02:32

clojure.test doesn't have global test fixtures, just per testing namespace fixtures, so adding shutdown-agents! there will break things for any tests run after that

1
respatialized00:02:57

I guess I just lucked out in that the suite that has that fixture happens to consistently run last

respatialized00:02:07

and/or none of the other tests depend upon namespaces that use/require agents for the capabilities being tested

respatialized00:02:11

sure enough, a local run with the shutdown-agents fixture commented out is hanging at the moment - if I'm relying on a fixture to prevent this from happening it sounds like I need to do some more work to track down the actual problem

respatialized00:02:01

@hiredman based on my read of the source, it seems like shutdown-agents will only get called if an exception is raised, which means that something like my fixture may still be necessary: https://github.com/cognitect-labs/test-runner/blob/334f2e2a5491747dff52f9ca8cbb4a53f54d344d/src/cognitect/test_runner.clj#L129

hiredman00:02:28

but System/exit is called if no exception happens

respatialized00:02:37

the real culprit was my own fault, a misplaced send "stop" call to an agent already in a "terminated" state that blocked the shutdown hook I had added to the runtime shutdown-agents had the appearance of fixing it because it terminated the agent before that send call.

meow10:02:44

What % of the Clojure community is constituted by Clojurescript?

pavlosmelissinos11:02:59

According to last year's State of Clojure survey, almost 62% of Clojure developers use Clojurescript https://www.surveymonkey.com/results/SM-S2L8NR6K9/

Akiz16:02:06

Hi, what is your preferred solution for implementing sliding window with transducers? I hoped that this: https://ask.clojure.org/index.php/2422/transducer-for-partition-all-with-step will be one of 1.11 updates 😶

Akiz16:02:52

It does, would you recommend it? I was discouraged by the last commit date so I created my own implementation but I will switch if that library is frequently used.

Alex Miller (Clojure team)16:02:53

stuff that works doesn't need commits :)

Noah Bogart16:02:02

Generally, last commit date isn't a good indicator of “good library” given how stable clojure is

💯 1
Akiz16:02:48

Of course not. But there are some issues and no updates so i wanted to be sure that there is no newer and better alternative. Thank you :-)

👍 1
simonkatz17:02:09

Any recommendations for tutorials on Clojure CLI / deps.edn for someone coming from Leiningen? (Some kind of mapping from how-to-do-X-with-Leiningen to how-to-do-X-with-deps.edn.)

Akiz17:02:06

Ive been using https://clojure.org/guides/deps_and_cli and google so far 🙂

seancorfield17:02:15

And there's the #tools-deps channel which is helpful when you're switching over. We went lein (2011) -> boot (2015) -> CLI / deps.edn (2018) at work so I'm happy to answer any specific Qs you might have @U06A9U5RP

simonkatz19:02:07

@seancorfield Thank you. I will ask specific questions there (after I’ve read up a bit more on the basics).

coetry18:02:37

I'm trying to use clj-new to scaffold a figwheel-main template, but am having some issues. @seancorfield any ideas?

clojure -Ttools install com.github.seancorfield/clj-new '{:git/tag "v1.2.381"}' :as clj-new
Checking out:  at 76f728dce63f7b881f4e5705ba0d59d795d56f11
Installed clj-new
coetry@Allens-MacBook-Air ~ % clj -X:new clj-new/create :template figwheel-main :name coetry/seven-guis :args '["--reagent"]'

WARNING: Specified aliases are undeclared and are not being used: [:new]
Namespace could not be loaded: clj-new

coetry@Allens-MacBook-Air ~ % clj -Tclj-new/create :template figwheel-main :name coetry/seven-guis :args '["--reagent"]'

Error building classpath. Unknown tool: clj-new/create

coetry@Allens-MacBook-Air ~ % clj -Tclj-new :template figwheel-main :name coetry/seven-guis :args '["--reagent"]' 

No function found on command line or in :exec-fn

coetry@Allens-MacBook-Air ~ % clojure -Tclj-new :template figwheel-main :name coetry/seven-guis :args '["--reagent"]'

No function found on command line or in :exec-fn

coetry18:02:40

maybe @U064J0EFR you might know?

dorab19:02:40

Try clj -Tclj-new create :template ...

coetry19:02:53

yup, that was it thanks!

seancorfield19:02:16

@U1KFUC2NA Happy to improve the clj-new README if that would help? It has this section on installation and use as a CLI tool: https://github.com/seancorfield/clj-new#installation-as-a-tool and then it has this section on installation and use via an alias in deps.edn: https://github.com/seancorfield/clj-new#installation-via-depsedn

Alex Miller (Clojure team)19:02:08

you said :as clj-new on the installation - that's the tool name

Alex Miller (Clojure team)19:02:07

then its clj -Tname function so here should be clj -Tclj-new create ...

Alex Miller (Clojure team)19:02:47

the -X:new didn't work as you didn't define the :new alias anywhere

Alex Miller (Clojure team)19:02:21

so should be:

clj -Tclj-new create :template figwheel-main :name coetry/seven-guis :args '["--reagent"]'

❤️ 1
James Vickers22:02:24

If I have the name of a symbol as it's used in a namespace, how do I resolve it? As in, a namespace the-ns requires another one like (:require [foo.bar :as baz]) and uses a symbol like baz/boo, how do I resolve the symbol baz/boo used in the-ns from another namespace e.g. to get meta on that symbol as it's defined in foo.bar? When I try something like (ns-resolve (find-ns 'the-ns) (symbol "baz/boo")) I get nil (find-ns returned a right-looking value as did symbol). Is there a way to do this?

hiredman22:02:08

user=> (ns foo)
nil
foo=> (def f 1)
#'foo/f
foo=> (ns bar (:require [foo :as f]))
nil
bar=> (in-ns 'user)
#object[clojure.lang.Namespace 0x522b2631 "user"]
user=> (ns-resolve 'bar 'f/f)
#'foo/f
user=>

hiredman22:02:00

also

user=> (ns-resolve (find-ns 'bar) 'f/f)
#'foo/f
user=>

dpsutton22:02:00

should that be (symbol "baz" "boo")?

hiredman22:02:06

user=> ((juxt namespace name) (symbol "baz" "boo"))
["baz" "boo"]
user=>

👍 1
hiredman22:02:24

user=> ((juxt namespace name) (symbol "baz/boo"))
["baz" "boo"]
user=>

dpsutton22:02:55

ah, i was remembering this little bit (map namespace [(symbol "foo/bar" "baz") (symbol "foo" "bar/baz")]) where the symbols print identically but have different namespaces

lilactown23:02:23

i'm looking for a way of serializing and storing clojure data in a compact way that would allow storing historical copies

isak23:02:43

https://github.com/lacuna/bifurcan > [ALPHA] durable (disk-backed) representations which share the API and asymptotic performance of their in-memory counterparts Haven't tested this, but may be worth looking into ^

lilactown23:02:22

yeah was looking at that

lilactown23:02:56

i.e. a file backed atom with on-disk structural sharing of some sort

datomic 1
lilactown23:02:53

i know of datomic but looking for something simpler 😛

phronmophobic23:02:36

I'm also interested in a library that could do what you describe.

potetm23:02:33

iirc @U053S2W0V did something like this a number of years back(?)

Joshua Suskalo00:02:50

although I don't think this does history

Joshua Suskalo00:02:21

you could use datahike which does hitchhiker trees for on-disk persistent kv store and then it builds a datalog query engine atop it

Joshua Suskalo00:02:29

it does have history

bbloom00:02:15

@U07S8JGF7 i did build something like this, but it never achieved production readiness in a way i felt comfortable sharing

bbloom00:02:12

the idea was generally mything is to datomic as redis is to postgres

lilactown02:02:50

yeah I'm looking for something akin to redis. maybe sqlite

lilactown02:02:09

I like the idea of persisting to a single file

lilactown04:02:36

I guess what I really need is serialization with structural sharing

Joshua Suskalo15:02:19

hitchhiker trees do that

Joshua Suskalo15:02:23

if nothing else

Joshua Suskalo15:02:49

they don't map cleanly to all clojure structures though necessarily