This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (9)
- # babashka (5)
- # babashka-sci-dev (23)
- # beginners (160)
- # calva (78)
- # cider (23)
- # clj-commons (2)
- # clj-kondo (5)
- # cljdoc (19)
- # cljs-dev (8)
- # clojure (54)
- # clojure-australia (1)
- # clojure-czech (2)
- # clojure-dev (17)
- # clojure-europe (8)
- # clojure-italy (8)
- # clojure-nl (2)
- # clojure-sg (3)
- # clojure-uk (4)
- # clojurescript (70)
- # community-development (8)
- # core-async (8)
- # cursive (7)
- # datahike (12)
- # datalog (22)
- # datomic (20)
- # events (1)
- # fulcro (43)
- # graalvm (92)
- # gratitude (5)
- # holy-lambda (77)
- # honeysql (1)
- # jobs (1)
- # lsp (111)
- # membrane (70)
- # nextjournal (13)
- # off-topic (73)
- # pathom (1)
- # polylith (8)
- # portal (32)
- # re-frame (3)
- # reagent (4)
- # reitit (5)
- # releases (2)
- # reveal (4)
- # xtdb (22)
Some sort of persistent queue literal has been discussed on and off since 2012: https://ask.clojure.org/index.php/3365/implement-reader-literal-support-persistentqueue-structure
Yeah, I think that's what the Jiras behind the Ask above ended up going with but I haven't checked the patches.
Having thought about it for many years, my current thought is that queues are not common enough to warrant syntax
In our 120K line code base, we have just three
PersistentQueue/EMPTY instances. One of those is in a test. One is in some production code but intended purely as a debugging aid. Only one is in mainline production code. Definitely not worth having a literal for us.
user=> (defn queue [& args] (into clojure.lang.PersistentQueue/EMPTY args)) #'user/queue
Hi Everyone, I'm looking for a library in Clojure (or Java for that matter) that can take a JSON document, or the schema of the document, and generate sample JSON that conforms to the schema. So far my Google-fu has let me down.
Mainly because otoh I’m thinking of using something like https://github.com/stathissideris/spec-provider to infer specs, then you can use generators to spit them out
Multiple json documents that conform. Hmmm... was wondering if there was something using spec. Will check this out, thank-you very much.
Crazy idea: I read somewhere the way to think about the Clojure REPL is: (1) you have some blob of live state, and (2) you submit code against it. This sounds a lot like a database, except the live state is not in relational form. I was wondering: are there any database oriented libraries, or database oriented languages in the following sense: In most current situations, code is 'first class' (IDE for it, github to save history, etc ...) while 'data' is often 2nd class. Is there any language setup where code & data are equally valued ?
http://composition.al/CMPS290S-2018-09/2018/12/13/state-is-progressive-or-hey-what-happens-if-we-make-literally-everything-append-only.html In the context of stateful distributed systems the need to have something like this becomes pretty evident, so you may be interested in these notes from a distributed systems course:
A smalltalk system where the image is stored in a CRDT so you can diff the state of two running systems would be super neat
Bloom is a research language based on a temporal variant of Datalog, which allows it to apply consistency models to data at the language level http://bloom-lang.net/faq/
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.66.7169&rep=rep1&type=pdf This paper purports to summarize the state of things as of 2005 so may be good for historical context
How is everyone handling errors in their Clojure programs? I don't think exceptions work very nicely in Clojure so I was wondering what alternatives there are
Better question, why don’t you think they work nicely? Then we can give alternatives to help
In pedestal, there is quite an interesting exception handling mechanism in the interceptor chains. http://pedestal.io/reference/error-handling
There are some general-purpose alternatives like returning errors as values, but users of your code will be surprised by this because, as others said, it’s not idiomatic in Clojure
When error’s aren’t exceptional I think it makes sense to return errors as values rather than use exceptions. Also you might for instance, when doing validation, want to return several error messages rather than throw just one exception.
True, I overgeneralized by saying it’s not idiomatic – better to say it’s not idiomatic for everything we might call an error
The premise is that when an error occurs you check the callstack for any function that has a desired way to handle that error, you call that handler, which may decide to unwind. Basically it decouples unwinding from error handling.
This works great for IO based stuff and other process-level concerns, but for data-level errors, I like flow https://github.com/fmnoise/flow
It's great for creating data pipelines that have considerations for errors inside them.
we use https://github.com/exoscale/ex at work, basically use ex-info everywhere and that remains compatible with other libs we have to interact with (from the java world)
it basically allows to express exceptions hierarchies in a way that's not horrible in clojure
Does the phrase “tyranny of the container” to describe typed languages originate from one of Rich's talks? I forget where I initially heard it but I use it all the time. At work (Scala shop) and my colleagues are getting pretty sick of hearing me mutter it under my breadth.
Looks like it's from "Effective Programs": https://github.com/matthiasn/talk-transcripts/blob/9f33e07ac392106bccc6206d5d69efe3380c306a/Hickey_Rich/EffectivePrograms.md
On Java 11 I'm calling this method
*newFileSystem*(*Path* path, *ClassLoader* loader) as
(FileSystem/newFileSystem (.toPath ...) nil) which is fine and doesn't need any reflection.
But on Java 17, there are more overloads where the second argument can be a different type, so I'm getting an error since the compile doesn't know which one to choose:
How do I make this call compatible with both Java 11 and Java 17? You cannot type hint
static FileSystem newFileSystem(Path path, ClassLoader loader) Constructs a new FileSystem to access the contents of a file as a file system. static FileSystem newFileSystem(Path path, Map<String,?> env) Constructs a new FileSystem to access the contents of a file as a file system. static FileSystem newFileSystem(Path path, Map<String,?> env, ClassLoader loader) Constructs a new FileSystem to access the contents of a file as a file system.