Re: calling a clojure function within a quote/(')

2017-11-17 Thread Matching Socks
In the docs: "syntax quote" on https://clojure.org/reference/reader -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with

Re: spec for an agent

2017-11-17 Thread Didier
> > Having said which, I could have a function make-agent-state and spec > that, then the body of make-agent is just (agent (make-agent-state > ...initialisers...)) Is that what you're suggesting? Ya, sorry, I didn't meant to sound like I was questioning why you needed to do X. This is what

Re: spec for an agent

2017-11-17 Thread Peter Hull
On Friday, 17 November 2017 16:53:57 UTC, Didier wrote: > > Why do you return an agent from a function? Can't you just return the map > it conatains instead? And spec that? I want to write a function spec (s/fdef) for a function make-agent that takes some initialisers and returns a new agent

Re: spec for an agent

2017-11-17 Thread Didier
Why do you return an agent from a function? Can't you just return the map it conatains instead? And spec that? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new

Re: calling a clojure function within a quote/(')

2017-11-17 Thread Armando Blancas
user=> (cond-> query #_=> true #_=> (conj '[? :data/number ?number]) #_=> true #_=> (conj `[(~'> ~'?number ~(foo 2))])) [:find ?e :in $ :where [? :data/number ?number] [(> ?number 3)]] On Friday, November 17, 2017 at 6:15:18 AM UTC-8, Njab Soul wrote: > > Hi guys I

[ANN] clj-queue-by 0.1.1

2017-11-17 Thread Stefan Kamphausen
Dear Clojurians, We've released a small queuing library which fills a gap that core.async didn't really fill for us. https://github.com/acrolinx/clj-queue-by * A central, easy to use, thread-safe, in-memory working queue. * Easy to inspect to allow monitoring. * Stateful, not persistent, uses

calling a clojure function within a quote/(')

2017-11-17 Thread Njab Soul
Hi guys I need your help. I want to make a clojure query, but the :where conditions are condition. SO i used cond->. this works well. but now my problem is that I want to make a clojure function call inside a (') or quote. (defn foo [num] (inc num)) (def query '[:find ?e :in

Re: spec for an agent

2017-11-17 Thread Timothy Baldridge
And google doesn't like that link, copy-paste that URL including the "!" On Fri, Nov 17, 2017 at 2:00 PM, Timothy Baldridge wrote: > All clojure ref types have validators that are perfect for this use case: > https://clojuredocs.org/clojure.core/set-validator! > > On Fri,

Re: spec for an agent

2017-11-17 Thread Timothy Baldridge
All clojure ref types have validators that are perfect for this use case: https://clojuredocs.org/clojure.core/set-validator! On Fri, Nov 17, 2017 at 1:58 PM, Peter Hull wrote: > I am using agents whose state is a map. I have a spec for this map, > ::agent-state. What's

spec for an agent

2017-11-17 Thread Peter Hull
I am using agents whose state is a map. I have a spec for this map, ::agent-state. What's the best way to validate the agent? I have: (s/valid? #(s/valid? ::agent-state (deref %)) myagent) Is this there a neater way to do this? (I actually want the spec to apply to the ret value of an