Hi All,
I had a terrible time trying to write a convenience macro for reading from a
core.async channel.
The idea was to make it easier to do the common dispatch on first part of a
message pattern, as in:
(let [[msg args] (! my-channel)]
(case msg
:msg1 (let [[a b] args]
Thanks for your reply. That's pretty much what I'd come to understand. I'm a
bit puzzled why this restriction exists though. Of course function calls can't
be resolved at macro expansion time, so it makes sense that ! ! inside
functions can't be found. But I don't understand why the go macro
OK I've filed this here:
http://dev.clojure.org/jira/browse/ASYNC-79
In trying to create a minimal test case I tried a trivial macro
(defmacro my-case [expr cases] `(case ~expr ~@cases))
inside a go block, and that worked fine, so it's more subtle than just case in
a macro is broken.
I
Hi All,
A while back I came across a project that could take cljs data and render it in
a nice readable way as HTML.
I was sure I bookmarked it, or starred the github repo, but now that I need it
there is no sign of it. Google searches are proving fruitless.
There is the abandoned
What is the impact of all this new goodness on in-browser development?
lein-figwheel + weasel has been the magic formula up until now. Is that
still the case?
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you
of the
functionality provided in Clojure. This is a good thing, what's there already
involves an amazing amount of complexity.
David
On Fri, Feb 20, 2015 at 2:48 AM, Tom Locke t...@tomlocke.com
mailto:t...@tomlocke.com wrote:
Are prefix lists supported in ClojureScript's (ns ...)?
It seems not, unless
Replying to myself : )
My "good enough" solution, in case it's of use to others, is
(defn set-hierarchy-root! [x root]
(if-let [p (-> x parents first)]
(set-hierarchy-root! p root)
(derive x root)))
(defn with-root [x root]
(when-not (isa? x root)
(set-hierarchy-root! x root))
One of the benefits of Clojure(Script)'s multimethods over traditional OO
polymorphism is that you can dispatch on multiple values. For example, we can
dispatch on the types of all the arguments, instead of just the first one:
(defmulti example (fn [x y] [(type x) (type y)]))
My question is
A quick follow-up - if I use s/assert instead of s/valid you can see the
problem with the s/or tag (:b in this case) getting into the assertion val
(s/assert (s/and (s/or :a (s/and #(empty? (::data %))
#(empty? (::path %)))
:b #(= (::val %)
Thanks very much - that makes sense now.
I had read the guide, and not noticed the fact that conformed values can be
used as the *input* to specs. I looked again and the section on composing specs
with and and or makes no mention of it.
This behaviour does get a mention in the section on
Hi all,
I'm writing a spec for a cursor-like type - a map with some ::data, a ::path
into the data, and a ::value - the value in the data at that path
I've written a spec that captures the constraint that (= (get-in data path)
value)
(s/valid? (s/and (s/keys :req [::val ::data ::path])
I'm using a fairly typical build setup with figwheel and lein, and running
a repl inside Cursive.
Does anyone have a nice solution for (re)building the project
with *compile-asserts* either on or off? According to the docs it's
"Initially set to boolean value of clojure.spec.compile-asserts
I'm working on a library, for which I would like to expose a single
namespace to users. I don't want users (including myself!) to have to
remember this function comes from foo-lib, this one comes from
foo-lib.utils etc.
Internally, however, I would very much like to split my code up into
> Dynamic load is simply not possible due to the restrictions of the
browser (all IO is async). A static load could be possible but I'm not
convinced that it would actually change much.
It seems to me this is a static problem that could have a static solution.
Even just a static in-ns
I don't think this addresses the issue.
I'll try to state the problem more simply:
Write a function that does not return until some channel event occurs.
(The difficulty being that go, put! and take! all return immediately)
I would argue the ability to do so is:
- fundamentally
In the early core.async presentation, Rich argues that we should avoid
putting application logic in callback handlers, and instead build the
"machine like" parts of our code in the core.async model. To bridge from
callback world to core.async we have put! and take! which we should call as
soon
16 matches
Mail list logo