I have a program where I change a lot of records based on id's in a
sequence. It is a manual process, so I want to give the user an option to
terminate the sequence. What would be the correct way to stop (for example)
a doseq?
--
Cecil Westerhof
--
You received this message because you are subs
I would replace it with loop/recur or a while, with both checking a
termination flag (probably an atom) which is set by the user.
An alternative approach would be core.async with a stop channel and then
use alt! to check them both simultaneously.
On 1 Mar 2015 10:30, "Cecil Westerhof" wrote:
> I
2015-03-01 11:33 GMT+01:00 Colin Yates :
> I would replace it with loop/recur or a while, with both checking a
> termination flag (probably an atom) which is set by the user.
>
I was just going to post that I was going to use a loop. You beat me to
it. ;-)
Probably being busy for to long, because
I know what you mean. After a year or so I still oscillate between a day of:
- naval gazing to uncover a lovely clean design, a few trivial bits
of clojure later and out comes a lovely, incidental-complexity free
implementation that reads like a conversation from the domain actors
in the real worl
A really good tip I read somewhere was that before you write *any* of your
own code check the core API and libs - it is almost certainly there.
https://jafingerhut.github.io/cheatsheet/grimoire/cheatsheet-tiptip-cdocs-summary.html,
clojuredocs.org and http://www.clojure-toolbox.com are invaluab
If I have a stateful thing with a lifecycle then is the system component
the instance of the thing or a wrapper that contains the thing.
For example, let's say I have a registry of clients that want to be polled
then I might have the following:
(defrecord Registry [state])
(defn register-with [
Hi all!
I’m working with core.async pub/sub and ran into an issue which I don’t
quite understand. According to the clojure.core.async/sub docstring:
> By default the channel will be closed when the source closes
This is not the behaviour I’m seeing when I call
clojure.core.async/unsub-all imme
Hi
Looks like the latest announcement from Nathan Marz (specter) may be of
use 😀
Philippe
--
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 -
The reason for the behavior you are observing is a race condition. The
effects of close! on the pub aren't synchronous. Even though the channel is
immediately closed before return, consumers need time to determine that it
has been closed. At the point in time the pub determines that the source
Hi!
I'm happy to announce the first version of Octet library.
_octet_ library offers, not intrusive (without additional wrapping),
composable and host independent abstraction for working with binary data.
It works out of the box with NIO ByteBuffer, Netty ByteBuf, and ES6
TypedArrays (clojurescr
Hopefully that makes sense. Let me illustrate.
(reduce + [1 2 3 4])
;=> 10
(reductions + [1 2 3 4)
;=> (1 3 6 10)
(-> 1 f g h)
;=> (h (g (f 1)))
I'm hoping to get a function that behaves like:
(--> 1 f g h)
;=> ((f 1) (g (f 1) (h (g (f 1
Any ideas?
Regards,
Bill
--
You received this mess
On Sunday, March 1, 2015 at 4:16:06 PM UTC-5, Bill Allen wrote:
>
> Hopefully that makes sense. Let me illustrate.
>
> (reduce + [1 2 3 4])
> ;=> 10
> (reductions + [1 2 3 4)
> ;=> (1 3 6 10)
>
> (-> 1 f g h)
> ;=> (h (g (f 1)))
>
> I'm hoping to get a function that behaves like:
> (--> 1 f g h)
>
Ok, for anyone following my adventures optimizing clj-uuid, I've gotten
another substantial win.
Check it out:
#'uuid/v1:443 nanoseconds
#'java.util.UUID/randomUUID: 2000 nanoseconds
==
user> (criterium
Ok, for anyone following my adventures optimizing clj-uuid, I've gotten
another substantial win.
Check it out:http://danlentz.github.io/clj-uuid
#'uuid/v1:443 nanoseconds
#'java.util.UUID/randomUUID: 2012 nanoseconds
Also, the test suite has much greater coverage with
Thanks for sharing Andrey!
Could you comment on how this compares with:
https://github.com/ztellman/byte-streams
Are the two complementary? Replacements?
On Monday, 2 March 2015 03:58:57 UTC+8, Andrey Antukh wrote:
>
> Hi!
>
> I'm happy to announce the first version of Octet library.
>
> _octe
Dammit, I knew as soon as I went and posted something with numbers I'd find
some low hanging fruit I overlooked. So now, 10x as fast.
#'uuid/v1:201 nanoseconds
#'java.util.UUID/randomUUID: 2012 nanoseconds
clj-uuid> (criterium.core/bench (uuid/v1))
Evaluation count :
I'm not quite sure what you want to do here in the general case but.a
few thoughts:
-> is implemented as a macro, whereas reduce and reductions are functions.
Depending on what you really want you may need a macro over a function.
Note that reduce is picky about the reducing function it tak
17 matches
Mail list logo