Re: [ANN] Clojure 1.10.0-beta1

2018-10-10 Thread Josh Tilles
I recently stumbled across this little example by Ghadi Shayban that helped *both* prepl and tap click for me: $ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0-beta2"}}}' Clojure 1.10.0-beta2

Re: accessing symbols in local context of a closure

2018-05-25 Thread Josh Tilles
My curiosity got the better of me: (require '[clojure.spec.alpha :as spec] '[clojure.test :refer [is with-test]]) (spec/fdef local-bindings :args (spec/cat :closure fn?) :ret (spec/map-of simple-keyword? any?)) (with-test (defn local-bindings [closure] (into {} (map

Re: Spec - is there any way to tell which keys are not described by a spec?

2018-01-05 Thread Josh Tilles
I think Stu Halloway’s proof-of-concept is at least close to what you want: https://gist.github.com/stuarthalloway/f4c4297d344651c99827769e1c3d34e9. (Here’s the context for that code, in case you were curious.) btw, you might want t

Re: Can't stop the system component

2017-06-06 Thread Josh Tilles
Dmitry, You need to return the updated component from start and stop. (See the relevant section of the documentation .) In your code, the start implementations are returning a keyword and the stop implementati

Re: with-open pattern

2017-05-04 Thread Josh Tilles
I think the “reducible streams” approach described by Paul Stadig here has potential. It might not cover all of the scenarios you’re thinking of, though. On Thursday, May 4, 2017 at 1:35:48 PM UTC-4, Brian Craft wrote: > > The with-open st

"Soft" failures with spec?

2017-02-17 Thread Josh Tilles
e times. 2. Use a single spec, but have rules for what ::s/problems are acceptable. So, what do you think? Has anyone tried anything along these lines? Does this sound fundamentally wrongheaded, trying to make spec do something it’s ill-suited for? Cheers, Josh Tilles 79 Madison Ave, 4th Floo

Re: Version control at the function level - a la Rich

2017-02-17 Thread Josh Tilles
I’m pretty sure you’re looking for codeq: http://blog.datomic.com/2012/10/codeq.html On Friday, February 17, 2017 at 4:39:12 PM UTC-5, Terje Dahl wrote: > > I recall Rich Hickey talking about this a few years back, but can't find > anything about it. > Am I just imaging it? > Or could someone

Re: spec and à la carte conformance of map vals (and maybe a bug)

2017-02-02 Thread Josh Tilles
. -- Josh Tilles [image: Signafire logo] 79 Madison Ave, 4th Floor New York, New York 10016 Tel: (646) 685-8379 <+16466858379> signafire.com <http://www.signafire.com/> -- On Sat, Jan 14, 2017 at 8:03 PM, Sean Corfield wrote: > A

Re: structuring parallel code

2017-01-30 Thread Josh Tilles
If your goal is “to operate on large data structures in parallel” then you’ll probably find Clojure’s reducers library to be helpful. On Monday, January 30, 2017 at 9:38:01 PM UTC-5, Brian Craft wrote: > > ans: this scales badly. > > There must be a way i

Re: clojure.core.match/match: very strange behavior

2017-01-30 Thread Josh Tilles
I’m not 100% sure about any of this, but I think you’re tripping on how core.match handles symbols . So in (match dt dt2 true :else false), the code is *not* comparing the value in the dt Var to the value in the dt2 Va

Re: spec and à la carte conformance of map vals (and maybe a bug)

2017-01-13 Thread Josh Tilles
ore, it seems likely that either the first or the third >is true, but I wanted to make sure I wasn’t being misunderstood first. Thank you, Josh > On Dec 19, 2016, at 5:26 PM, Alex Miller <mailto:a...@puredanger.com>> wrote: > > On Monday, December 19, 2016 at 2:42:49 PM UT

spec and à la carte conformance of map vals (and maybe a bug)

2016-12-19 Thread Josh Tilles
Hi all, On several occasions, Alex Miller has emphasized that we should be wary of “baking in” conformers when defining specs. I agree with him, but it’s not clear to me how to “opt in” to using conformers on map vals. As far as I can tell, I’m either limited to using unqualified keys —which enabl

Re: Namespace question and request for project with non-trivial use of clojure.spec

2016-12-16 Thread Josh Tilles
Although I can’t recall off the top of my head any example applications that demo non-trivial spec usage, you might be able to find some good projects using CrossClj: https://crossclj.info/ns/org.clojure/clojure/1.9.0-alpha14/project.clj.html#used. (There’s a good chance that any project that’

Re: s/valid? vs. s/explain

2016-11-13 Thread Josh Tilles
Just going on memory at the moment, but I’m pretty sure `s/explain` just writes to `*out*` (and thus always returns `nil`). You probably want `s/explain-data` or `s/explain-str`. -Josh On Sun, Nov 13, 2016 at 10:58 AM James Gatannah wrote: > One of my system boundary data structures is particul

Re: Spec & test.check generators for complex data structures

2016-11-01 Thread Josh Tilles
I don’t have any answers, but you might find the discussion in the first several messages of this thread to be relevant. On Tuesday, November 1, 2016 at 3:14:28 PM UTC-4, Maarten Truyens wrote: > > Completely convinced of Spec,

Re: Java like static typing for Clojure?

2016-10-21 Thread Josh Tilles
Out of curiosity, did you try Typed Clojure? It certainly has its rough edges, but you sound willing to bear the burden of annotating code with types (at the top-level, at least) and I *think* its treatment of Java interop does what you want: unless instructed otherwise, the typechecker assumes

Guidelines/Recommendations for namespaces and qualified keywords

2016-10-15 Thread Josh Tilles
I’ve got a couple questions for Alex Miller and/or the other Cognitect folks. 1. *Are single-segment namespaces still “bad” when it comes to registering specs under qualified keywords?* In the past, single-segment namespaces have been discouraged in the Clojure community—both becaus

Re: clojure.spec, conform and returned value

2016-10-11 Thread Josh Tilles
I think you’re looking for conformer ; the spec it produces will pass along the converted value instead of the original input. It could be used like: (defn str->double [s] (try (Double/valueOf s)

Re: Idiom question

2016-09-28 Thread Josh Tilles
By the way, the order of arguments of as-> makes more sense when it’s used *within* one of the other threading macros. For example: (-> x foo (bar y) (baz w z) (as-> mid-x (log/debug "The intermediate value:" mid-x) (if (color-requested? mid-x) (assoc mid-x :color "periwinkle

Re: wondering why spec.test/instrument doesn't check :ret

2016-08-06 Thread Josh Tilles
I’m not sure it answers your question *directly*, but a quote from Rich in another thread seems relevant: On Monday, July 11, 2016 at 10:01:05 AM UTC-4, Rich Hickey wrote: > On Sunday, July 10, 2016 at 6:04:39 AM UTC-4, puzzler

Re: Spec of conform of spec

2016-06-18 Thread Josh Tilles
I just realized that in my example, I probably should have used `s/get-spec` instead of `s/spec` when defining the labels. Oh well. On Saturday, June 18, 2016, Josh Tilles wrote: > Have you considered choosing labels that are themselves qualified > keywords with registered specs? That

Re: Spec of conform of spec

2016-06-18 Thread Josh Tilles
Have you considered choosing labels that are themselves qualified keywords with registered specs? That might feel like a workaround, but I think it could get you most of what you’re looking for. For example: ``` (s/def ::even-spec even?) ;= :user/even-spec (s/def ::odd-spec odd?) ;= :user/odd-spe

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-12 Thread Josh Tilles
On Sunday, June 12, 2016 at 10:29:56 PM UTC-4, Alan Thompson wrote: > > I would have expected the namespaces to avoid this kind of conflict. Why > don't they? > Because the conflict was only introduced five days ago, with this commit

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-08 Thread Josh Tilles
Well, it’s worth noting that clojure.core/name does account for strings : (defn name "Returns the name String of a string, symbol or keyword." {:tag String :added "1.0" :static true} [x

Re: Addressing Matthias Felleisen's concerns?

2016-05-09 Thread Josh Tilles
On Monday, May 9, 2016 at 5:36:53 PM UTC-4, Didier wrote: > > At Clojurewest 2016, Matthias Felleisen gave a great keynote about the > pragmatism of soundness for maintening large code bases. He mentioned that > adding type gradually was useful, but only when the border between typed > land and

Re: Running Clojure apps using less memory.

2016-03-28 Thread Josh Tilles
Hi Jason, I have a hunch that you have more Java processes running than you need and/or are aware of. For example, by running your Clojure app via lein run -m clojureweb.core/serve, you have two Java processes: one for Leiningen, and a separate one (started by Leiningen) for your app. It’s unli

Re: Partial question

2016-02-23 Thread Josh Tilles
My guess is that what you're looking for is: (def debug #(log "DEBUG" % :idVE "COM")) (see "Anonymous function literal" under http://clojure.org/reference/reader#_dispatch) However, note that defining functions in a "point-free"-ish style in Clojure has a downside with regard to metadata, in tha

How is the emphasis of “data over code” different than the XML advocacy of the early 2000s?

2016-02-01 Thread Josh Tilles
As I’m watching Michael Drogalis’s Clojure/Conj 2015 presentation “Onyx: Distributed Computing for Clojure” , I'm distracted by a nagging worry that we —as a community— are somehow falling into the same trap as the those advocating XML in the early

Re: Library suggestions requested for clojure-toolbox.com

2015-10-13 Thread Josh Tilles
Also, you may want to replace MidjeDoc with Hydrox <https://github.com/helpshift/hydrox>. On Tuesday, October 13, 2015 at 6:32:50 PM UTC-4, Josh Tilles wrote: > > James, I've provided a bit more information than you requested because I > figured mailing list readers might fi

Re: Library suggestions requested for clojure-toolbox.com

2015-10-13 Thread Josh Tilles
James, I've provided a bit more information than you requested because I figured mailing list readers might find the extra details useful. - durable-queue - URL: https://github.com/Factual/durable-queue - GitHub description: “a disk-backed queue for clojure” - Categories:

Re: Using metadata to specify how calls to a macro should be indented

2015-09-15 Thread Josh Tilles
On Sunday, September 13, 2015 at 8:25:42 AM UTC-4, Artur Malabarba wrote: > > > On 13 Sep 2015 12:33 pm, "Matching Socks" > wrote: > > > > Unless clojure.core itself will carry these annotations, could the > keyword be namespaced? > > Or do you mean it should be ::indent? (i.e., carry the names

Re: Stuart Sierra's Component: retries & restarts in production

2015-09-04 Thread Josh Tilles
I just found the other resources from the Component wiki —it may be that something linked from there addresses exactly my situation. On Wednesday, September 2, 2015 at 8:44:07 PM UTC-4, jo...@signafire.com wrote: > > TLDR: how do you use