Re: Comparison with atom values

2015-02-12 Thread Max Countryman
To compare the value of the atom, you should deref it first. Using deref, you’ll get the current value of the atom: => (deref a) 0 Or using the reader macro: => @a 0 So: => (= @a 0) true Hope that helps, Max > On Feb 12, 2015, at 11:27, Newbie wrote: > > I am trying to compare atom valu

Re: Multimethod or protocol or...? Clojure design feedback

2015-05-14 Thread Max Countryman
I personally prefer multimethods, generally speaking—I think they feel more idiomatic. Although it does depend on the context of what you’re doing. In some cases a protocol may be the correct choice. Here the multimethod seems fine. > On May 14, 2015, at 16:34, Jason Marmon wrote: > > I'm wor

Re: Using :refer 'sparingly'

2015-05-17 Thread Max Countryman
I wonder if a reason could be to ensure it’s obvious where a function came from? For example (foo …) is ambiguous, it could be defined in the current namespace or it may have been referred from another whereas (my-ns/foo …) is explicit. > On May 17, 2015, at 08:04, Akiva wrote: > > In Stuart

Re: are there any real examples on Github of how to use reducers?

2015-05-21 Thread Max Countryman
Kyle Kingsbury’s linearizability checker “Knossos” uses reducers. (See the core, history, and util namespaces.) https://github.com/aphyr/knossos > On May 21, 2015, at 19:55, piastkra...@gmail.com wrote: > > > Can anyone point me to a project on Github that is using Clojure 1.5 > reducerers?

A more general case of some->?

2014-07-21 Thread Max Countryman
Hi, Recently I found myself wanting a macro similar to some-> or some->> but one where I could specify an arbitrary predicate instead of nil?. For example, I have a Ring request map which I wish to pass through a number of functions. Any of these functions might return an error response and if

Re: Clarity on Stuart Sierra's component system

2014-11-28 Thread Max Countryman
Hi Colin, I'm by no means an expert on Component but I have used it for my last several projects. What I've discovered is where I have query functions such as yours I pass the db component through to their call sites from a component which contains the db as state. For example, I have a compone

[ANN] Flake 0.4.0: Decentralized, k-ordered unique ID generator

2016-06-02 Thread Max Countryman
Hi, I’m happy to announce a new release of Flake, the decentralized, k-ordered unique ID generator. Flake 0.4.0 includes a number of important breaking changes, but by far the most important is dropping `generate` in favor of `generate!` which now returns a ByteBuffer. Previously `generate` re

Re: [ANN] Flake 0.4.0: Decentralized, k-ordered unique ID generator

2016-06-03 Thread Max Countryman
ng > for equality? > > On Thu, Jun 2, 2016 at 6:03 PM, Max Countryman <mailto:m...@me.com>> wrote: > Hi, > > I’m happy to announce a new release of Flake, the decentralized, k-ordered > unique ID generator. > > Flake 0.4.0 includes a number of important breaking

Re: [ANN] Flake 0.4.0: Decentralized, k-ordered unique ID generator

2016-06-03 Thread Max Countryman
Hi again, I just released flake 0.4.1, containing a bugfix where `timer/read-timestamp` would throw an uncaught exception when the provided path did not exist. Thanks, Max > On Jun 2, 2016, at 18:03, Max Countryman wrote: > > Hi, > > I’m happy to announce a new releas

Re: [ANN] Flake 0.4.0: Decentralized, k-ordered unique ID generator

2016-06-16 Thread Max Countryman
erhaps at least comparable to at least one implementation of a UUID, that really isn’t the reason to use Flakes in the first place. Also if my tests aren’t set up correctly, I’d certainly appreciate any help correcting them! Max > On Jun 3, 2016, at 08:40, Max Countryman wrote: > >

Re: [ANN] Flake 0.4.0: Decentralized, k-ordered unique ID generator

2016-06-17 Thread Max Countryman
wanted to take a stab at it otherwise I may try my hand at making this improvement. :) > > Bruno > > > On Friday, June 3, 2016 at 4:40:26 PM UTC+1, Max Countryman wrote: > Hi Mark, > > I haven’t done any benchmarking comparing Flakes to UUIDs. However the > primary bene

Re: [ANN] Flake 0.4.0: Decentralized, k-ordered unique ID generator

2016-06-21 Thread Max Countryman
Brian, I think you make good points here, especially with regard to the size of IDs. I’d also like to point out that while adding the process and thread IDs helps, it doesn’t eliminate the possibility of duplicate IDs: this is why it’s necessary to write out the last used timestamp in a separat

Re: [ANN] Flake 0.4.0: Decentralized, k-ordered unique ID generator

2016-06-21 Thread Max Countryman
I also released Flake 0.4.2 today which includes an important bugfix where two competing threads could have caused duplicate IDs in certain circumstances as well as a new method for deriving timestamps. > On Jun 21, 2016, at 16:29, Max Countryman wrote: > > Brian, > > I thin

Re: [ANN] Flake 0.4.0: Decentralized, k-ordered unique ID generator

2016-06-22 Thread Max Countryman
> On Jun 22, 2016, at 06:27, Bruno Bonacci wrote: > > @Brian, The clock drift problem was in answer to your question and generally > it was referring to the pure System/currentTimeMillis implementation. The > System/nanoTime, as it is now, is completely broken as it offsets against the > wall

Re: Using a function in another function

2016-11-10 Thread Max Countryman
The issue is (add1 (add1 [x])) is malformed: you probably mean (add1 (add1 x)). An addn function could be implemented with iterate: (defn addn [n x] (nth (iterate add1 x) n)) > On Nov 10, 2016, at 06:51, 'Rickesh Bedia' via Clojure > wrote: > > I have this function: > (defn add1 [x] >

Re: Clojure/Pedestal vs Go

2015-09-13 Thread Max Countryman
Hi, I'd love to see some discussion about this as well: I've struggled to justify the JVM in a production environment that's dominated by Go. My experience with my team has been that they are very unwilling to use the JVM and will go to great lengths to avoid it. The argument seems to be that G

Re: Clojure/Pedestal vs Go

2015-09-15 Thread Max Countryman
Hi Alan, >From my experience this is not true: Go does not provide generics and actively >resists what most of us would consider good functional programming--Go is very >opinionated and doesn't allow much deviation from these opinions, by design. >So implementing practical immutable data struc

Re: Clojure/Pedestal vs Go

2015-09-15 Thread Max Countryman
Alan, Absolutely no need to apologize! :) I would hardly consider myself an expert either, I’m basing my understanding on the experiences I’ve had at my day job and the large body of developing articles and blogposts related to the language that seem to pop up at a near-constant rate on your fa

Tools comparable to Luigi for Clojure or the JVM?

2015-09-16 Thread Max Countryman
Hi, I’m working on a project at work for which we’re currently considering a Python tool built by Spotify called Luigi[1]. Luigi is a tool for building data processing pipelines (hence the name). It’s capable of connecting to various processors such as Hadoop and is limited in scope to building

Re: A generalization of iterate

2015-09-22 Thread Max Countryman
I wonder if something like this is a little easier to read? (defn generate ([f coll] (generate f coll (reverse coll))) ([f coll args] (let [next-val (apply f args)] (lazy-cat coll (generate f [next-val] (conj (butlast args) next-val)) Where your Fibonacci example becomes: (ta

Re: A generalization of iterate

2015-09-23 Thread Max Countryman
terate is > Java; and for some reason 'recur' can't be used inside of lazy-cat (not > really documented, but apparently true). > >> On Tuesday, September 22, 2015 at 9:21:57 PM UTC-7, Max Countryman wrote: >> I wonder if something like this is a littl

Re: Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread Max Countryman
Hi James, I’m not sure if it’s worth mentioning, but I wrote a port of Boundary’s Flake k-ordered unique ID generator for Clojure: https://github.com/maxcountryman/flake Max > On Oct 5, 2015, at 12:40, James Reeves wrote: > > If you've written or kno

Re: Heard about clojure today. is it one of the big tecnologies for the future? or is it becoming deprecated?

2016-01-20 Thread Max Countryman
Clojure is not becoming deprecated. A major release happened just yesterday in fact. > On Jan 20, 2016, at 08:04, Miguel Domingos > wrote: > > Hi, > > Just checked GIT Hub Pulse and it is very low. I just heard about this > technology today, so I don't know. > https://github.com/clojure/clo

Re: find shorter clojure code automatically

2016-03-03 Thread Max Countryman
Hi Jeremy, My understanding is Eastwood might be a tool which can find some specific kinds of syntax sugar in automated way. Check it out: https://github.com/jonase/eastwood/blob/master/README.md Max > On Mar 4, 2016, at 03:33, Jeremy Vuillermet > wrote: > > Hello, > > Every time I go t