Hi,
Here's a function and a simple use of it. It works, but the code may not be
good Clojure. I'm wondering how it might be better.
(defn distinct-by
"Returns a sequence with no repeats of (f item).
A set is built up internally as the sequence is consumed, so don't use it
on
an infinite
Yes, I find that much clearer too. Thanks!
On Saturday, July 22, 2017 at 4:50:23 PM UTC-4, tbc++ wrote:
>
> If we think about what we're doing here is a stateful filter, then maybe
> we could leverage a few more core Clojure functions:
>
>
> (defn distinct-by [f coll]
> (let [seen (atom #{})]
>
I'm translating some code from an object oriented language to Clojure. I'm
a little confused about a tree structure I had where tree nodes have parent
and children properties, so the structure forms cycles. I used atoms for
those properties, so I could wire it all up. The code is clean and simpl
I think in my case here the easiest thing will be to remove the cycles, but
still I'd like to understand a couple things...
On Sunday, July 23, 2017 at 10:12:46 PM UTC-4, Didier wrote:
>
> I'm not sure I can fully help without you explaining more what you're
> doing. It sounds like you've got a
Hi,
The lein command `lein help test` explains that you can add metadata to
tests and select subsets of tests to run. Is there a way to do something
like that from the REPL (clojure.test/run-tests) without lein?
Rob
--
You received this message because you are subscribed to the Google
Groups
I get this when I switch from 1.8 to 1.9 beta, but maybe it's an issue with
the `core.match` library?
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace:
clojure.tools.analyzer.utils, being replaced by:
#'clojure.tools.analyzer.utils/boolean?
Rob
On Thursday, September
Hi,
Say I have a map like this:
(def m {:qs [{:nums [3 1 2]} {:nums [7 4]}]})
I want to transform each number with a function (say, `inc`). I imagine
something like this:
(update-in m [:qs * :cell-fns] #(map inc %))
; or
(update-in m [:qs * :cell-fns *] inc)
But of cours
Gah. I changed one name and not another. I meant:
(update-in m [:qs * :nums] ...)
On Tuesday, October 10, 2017 at 10:18:56 AM UTC-4, Rob Nikander wrote:
>
> Hi,
>
> Say I have a map like this:
>
> (def m {:qs [{:nums [3 1 2]} {:nums [7 4]}]})
>
> I want to tran
Hi,
Why doesn't this compile? I tried to comment out the "private" metadata.
(def #_^:private foo 1)
CompilerException java.lang.RuntimeException: First argument to def must
be a Symbol, compiling:(null:1:1)
Rob
--
You received this message because you are subscribed to the Google
Grou
On Friday, October 13, 2017 at 2:55:51 PM UTC-4, Justin Smith wrote:
>
> what happens is that the metadata reader macro is applied before the
> comment reader macro, so you comment out the name of the def (which also
> had the metadata attached)
>
> user=> '(def #_ ^:private foo 1)
> (def 1)
>
Hi,
I’m wondering if there is a core.async design idiom for this situation...
- A buffered channel
- One producer feeding it
- A bunch of consumers pulling from it.
- Producer should wake up and fill the channel only when it’s empty. In
other words, the producer should work in chunks.
My firs
On Friday, January 5, 2018 at 2:03:00 PM UTC-5, Brian J. Rubinton wrote:
>
>
> What is the buffered channel’s buffer used for? If that’s set to 1 and the
> channel’s transducer is `(mapcat identity)` then the producer should be
> able to continuously put chunks of work onto the channel with the
Thanks for the explanation! This is very close to what I want. I see some
confusing behavior though. See below.
On Friday, January 5, 2018 at 2:40:14 PM UTC-5, Brian J. Rubinton wrote:
>
>
> The work-queue channel has a fixed buffer size of 1. A collection (range
> 50) is put on the channel. Whi
On Friday, January 5, 2018 at 4:00:25 PM UTC-5, Moritz Ulrich wrote:
>
>
> You have a channel with a buffer-size of one. You clear the buffer by
> taking one item from it, making room for another one. Therefore the put
> succeeds. Try just `(async/chan nil xform)` to create a channel without
>
On Jan 5, 2018, at 8:01 PM, Gary Verhaegen wrote:
> What about simply having the producer put items one by one on the channel?
I will do that. My current producer is doing too many other things, but if
I break it up into separate threads or go blocks for each work queue, then
that should wor
I have some Clojure code that throws this, occasionally. Unfortunately I
can’t paste my real function here, but it looks much like the one below.
(Changed variable names and simplified some irrelevant - I hope - details).
Anything jump out as a memory-leak?
It queries a DB table to get a li
On Friday, March 2, 2018 at 12:48:28 AM UTC-5, Daniel wrote:
>
> How do you know this code is causing the error? Unless this is all your
> code does, descriptions of the error suggest the memory leak might be
> coming from anywhere. This tight loop might trigger too many successive GCs
> thoug
Hi,
I see this was discussed before. Did it go anywhere? Basic idea: make a
`dosync` transaction succeed or fail along with a database transaction.
https://groups.google.com/forum/#!topic/clojure/qiKnCVAaZKw
Rob
--
You received this message because you are subscribed to the Google
Groups "Clo
On Friday, March 23, 2018 at 4:26:37 PM UTC-4, Andy Fingerhut wrote:
>
> I do not know what the result of that discussion was, but I would guess it
> did not turn into a change that was incorporated into Clojure. In the
> discussion thread you linked to, Dave Griffith mentioned attaching a pat
Hi,
I just watched a chunk of this talk from a few months ago ("Maybe Not"
[1]). Is there a pre-release version of spec available, that has `schema`
and `select` in it? I have a project where I'm fine with using bleeding
edge stuff that will change.
Rob
[1]: https://www.youtube.com/watch?v=YR
Thanks, I will do 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 members are moderated - please be patient with your
first post.
To unsubscribe from this g
21 matches
Mail list logo