This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-25
Channels
- # announcements (4)
- # babashka (58)
- # beginners (21)
- # calva (42)
- # clj-kondo (15)
- # cljdoc (16)
- # cljs-dev (11)
- # clojure (57)
- # clojure-denmark (1)
- # clojure-europe (24)
- # clojure-france (4)
- # clojure-nl (1)
- # clojure-norway (16)
- # clojure-spec (6)
- # clojure-uk (2)
- # clojurescript (19)
- # clr (4)
- # conjure (1)
- # core-logic (3)
- # cursive (5)
- # data-science (2)
- # datascript (6)
- # datomic (3)
- # emacs (4)
- # events (3)
- # fulcro (17)
- # gratitude (2)
- # hyperfiddle (4)
- # introduce-yourself (3)
- # jobs-discuss (2)
- # lsp (27)
- # malli (22)
- # pathom (73)
- # portal (21)
- # re-frame (5)
- # releases (1)
- # vim (8)
- # xtdb (28)
Anyone recall a talk where Stuart Halloway defined a spec for a third-party library, then caught an obscure bug using generative testing on it?
I think that's Running With Scissors: https://github.com/matthiasn/talk-transcripts/blob/master/Halloway_Stuart/RunningWithScissors.md where he found a bug in the chart library?
Is there a way to programatically create aliased qualified keywords, ie, ::itunes/summary
?
I'm using clojure.data.xml
and have defined an xmlns alias with (xml/alias-uri 'itunes "
. However, as far as I'm aware, there is no way to programatically create a ::
keyword that can resolve to the alias created by xml/alias-uri
. Is that correct?
I can kind of see it being a reader thing, how ::
keys must be known in advance in order to be resolved, as opposed to the concrete qualified syntax that has no outside dependence.
(ns-name (get (ns-aliases *ns*) 'itunes))
should give you qualified namespace symbol which alias refer to.
user=> (require '[clojure.data.xml :as xml])
nil
user=> (xml/alias-uri 'xh "")
nil
user=> (def xh (name (ns-name (get (ns-aliases *ns*) 'xh))))
#'user/xh
user=> (keyword xh "summary")
:xmlns.http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml/summary
What would that mean?
i guess that means using URI instead of namespace in require with as-alias
I don’t see how that would be possible while still getting the uri aliasing
I guess it would mean evaling the alias name expression. I don’t think that’s a door we want to open
you mean like this ?
clj -e "(do (require 'clojure.test) (alter-var-root #'clojure.test/*load-tests* (constantly true)))" -r
That might be a reasonable var to add to https://github.com/clojure/clojure/blob/527b330045ef35b47a968d80ed3dc4999cfa2623/src/clj/clojure/main.clj#L83-L101 so that you can just set!
it
Worth an ask
:)
Personally I use clojure.test/*load-tests*
in conjunction with a specific way of using tools.namespace
Are there any strategies for gathering the modules belonging to a namespace at runtime. So if I have my.ns.foo
and my.ns.bar
, can I do something like (map (fn [x] (x/method args) (gather-modules-under 'my.ns))
? such that I get the equivalent of (do (my.ns.foo/method args) (my.ns.bar/method args))
there is no relationship between my.ns.foo and my.ns.bar other than the name shares a common prefix
sub-namespace then, but you've answered the question. So I guess my other option is to use in-ns
to separate "modules" into multiple files and then use something like ns-publics
to access their vars. I seem to remember having problems with that strategy previously when it came to hotloading changes to the namespace
"sub-namespace" implies some kind of hierarchy between namespaces still, and there is none. it is a flat key space (a single k/v map not a filesystem of nested trees)
Hello! May you can point me out some solution... I do need to generate some Parquet files from my Clojure code... but I'm struggling to find a way... all examples that I've found are broken in some way... I've found this PigPen library from Netflix, but even the example shown in the readme of the project are not working... Can someone help me?
Hi! I'm trying to write this snippet of Java code into Clojure, but not succeed... can you help me?
Schema schema = new Schema.Parser().parse(avroSchema)
Parser is a nested class in Schema in java, and the way that gets compiled for the jvm is Parser generates a class named Schema$Parser entirely distinct from the Schema class
Because eventually you'll https://github.com/nomnom-insights/abracad/blob/f7b399e323b7972e9fe631721ab035500623f7a1/src/clojure/abracad/avro.clj#L22-L24 - at least to avoid reflection
it works! tks, guys! Can I ask another thing? How can I rewrite this piece of code?
ParquetWriter<GenericRecord> writer =
AvroParquetWriter.<GenericRecord>builder(path)
.withSchema(schema)
.withCompressionCodec(CompressionCodecName.SNAPPY)
.build()
this 'Generics' thing... I've no idea how to code this with clojure..
I've trid this way, but do not work:
writer (-> (.builder AvroParquetWriter path)
(.withSchema schema)
(.withCompressionCode CompressionCodecName/SNAPPY)
(.build))
I got this error: "No matching method builder found taking 1 args for class java.lang.Class"
Because builder
is static, it should be (-> (AvroParquetWriter/builder path) ...)
.
I've tried this way
(let [schema (.parse (Schema.Parser.) avroSchema)])
but don't work...Is there a way to invoke a long-running function in the REPL that will continue even if the REPL process dies ?
(long answer, depends what you mean by process, but if you mean a os process, then the only way to run something that outlives a given process is to run another process)
so i lost the connection to the REPL and it was unclear if the other thread was killed too