Re: [ANN] thurber: Clojure on Apache Beam (distributed batch/streaming)

2020-01-24 Thread Beau Fabry
Hi Aaron, I was I guess the lead developer on clj-headlights. If you have any questions feel free to hit me up. It is afaik not actively maintained by anyone anymore. Cheers, Beau On Wednesday, January 22, 2020 at 8:21:57 AM UTC-8, Aaron D. wrote: > > > Hi Dominic thank you! > > Are you

Re: Translation of the QuickCheck properties in the paper "How to specify it!" by John Hughes into clojure test.check

2019-07-19 Thread Beau Fabry
Added a reporting property and tweaked the key generator to be closer to the numbers in the paper On Thursday, July 18, 2019 at 8:25:25 AM UTC-7, Beau Fabry wrote: > > https://github.com/bfabry/specify-it > > Attempted translation of the QuickCheck properties in this paper: > &g

Translation of the QuickCheck properties in the paper "How to specify it!" by John Hughes into clojure test.check

2019-07-18 Thread Beau Fabry
https://github.com/bfabry/specify-it Attempted translation of the QuickCheck properties in this paper: "How to specify it!" - John Hughes https://www.dropbox.com/s/tx2b84kae4bw1p4/paper.pdf?dl=0 Into Clojure test.check properties. I recreated the first 5 bugs in the paper (and the test.check

Re: 1.8 vs 1.9 performance

2017-12-26 Thread Beau Fabry
We updated 2 apps to 1.9 about a month ago, I believe another team is planning to update next week. No issues. On Monday, December 25, 2017 at 2:45:01 AM UTC-8, John Stevenson wrote: > > Our team has been running in production on Clojure 1.9 release candidates > for the last 4 months. We

Re: [core.spec] Stricter map validations?

2017-11-10 Thread Beau Fabry
specs. And why prototyping needs >>> should not be a primary concern in how s/keys behaves. >>> >>> I have tried to make a case for current behavior: It allows to say a key >>> is there, without saying anything about its value. I have pointed out (s. >>>

Re: [ANN] Clojure 1.9.0-RC1

2017-11-10 Thread Beau Fabry
We've switched both of our main projects to RC1 and have had no issues yet. On Thursday, November 9, 2017 at 11:49:07 PM UTC-8, Sean Corfield wrote: > > We have three processes running RC1 in production as of today. Looks good > so far. We’ve had everything else up and running on Beta 4 in

Re: Don't Laugh - How to Get the Name of an Anonymous Function

2017-10-24 Thread Beau Fabry
If I had to guess I'd say the name of the function isn't stored with it nil boot.user=> (clojure.reflect/reflect (fn foo [] nil)) {:bases #{clojure.lang.AFunction}, :flags #{:public :final}, :members #{#clojure.reflect.Constructor{:name boot.user$eval1530$foo__1531, :declaring-class

Re: [core.spec] Stricter map validations?

2017-10-09 Thread Beau Fabry
checking the _*value*_ >> associated with a _*key*_ is in keeping with the design principles of >> spec which focus on maps being based on a *key set*, while offering >> functions to allow you to optionally check values. >> >> >> >> Sean Corfield -- (970

Re: [core.spec] Stricter map validations?

2017-10-06 Thread Beau Fabry
well spec that key with "any?". > > What are other benefits? They must justify the expense of likely runtime > errors. > > > On Friday, October 6, 2017 at 5:34:16 PM UTC+2, Beau Fabry wrote: >> >> Leon, perhaps you could add this code to your test suite? >

Re: [core.spec] Stricter map validations?

2017-10-06 Thread Beau Fabry
; > Kind regards, > Leon. > > > On Wednesday, October 4, 2017 at 7:05:29 PM UTC+2, Beau Fabry wrote: >> >> Seems like that's the reasonable place to check it, otherwise you're >> forced into an ordering for your specs and cannot write recursive strict

Re: [core.spec] Stricter map validations?

2017-10-04 Thread Beau Fabry
Seems like that's the reasonable place to check it, otherwise you're forced into an ordering for your specs and cannot write recursive strict map specs. On Wednesday, October 4, 2017 at 8:59:59 AM UTC-7, Yuri Govorushchenko wrote: > > Thanks. This approach is also different from the macro

Re: Help ship Clojure 1.9!

2017-10-03 Thread Beau Fabry
We've been using 1.9 in a small app for a while with no issues. After upgrading schema to the latest version (with the PR above) I've also successfully run our larger codebase with 1.9. On Tuesday, October 3, 2017 at 4:41:14 AM UTC-7, stuart@gmail.com wrote: > > Hi Mark, > > I think this

Re: [core.spec] Stricter map validations?

2017-10-02 Thread Beau Fabry
fwiw, I vote for leaving it. It's extra flexibility and is afaict a fairly easy error to catch. Here's a function that I think should give you every qualified keyword that is used in a spec but that does not have a spec defined for it: boot.user=> (let [kws (atom #{})] #_=>

Re: [core.spec] Stricter map validations?

2017-10-02 Thread Beau Fabry
> 1) Is there any way to ensure that the keys I used in `s/keys` have the associated specs defined? I think you should be able to do this by writing a function that uses s/registry s/form and s/get-spec On Monday, October 2, 2017 at 8:37:31 AM UTC-7, Yuri Govorushchenko wrote: > > Hi! > > I

Re: Is there a way to use spec/fdef function specs with clojure.test ?

2017-09-29 Thread Beau Fabry
Can't you just assert on the return value of spec.test.check in a clojure.test test? ie, this is a test in one of our repos: (deftest ^:spec generative (is (not-any? :failure (st/check [`export/invert-table->account-ids] On Friday, September 29, 2017 at 3:36:26 AM UTC-7, Khalid Jebbari wrote:

Re: Help ship Clojure 1.9!

2017-09-28 Thread Beau Fabry
Identified an issue with prismatic/schema https://github.com/plumatic/schema/pull/399 On Thursday, September 28, 2017 at 9:18:52 AM UTC-7, Nathan Fisher wrote: > > Hi Stuart, > > Looks like any project using lein-cljsbuild will be affected. > > I forked and bumped the Clojure and ClojureScript

Re: Obtaining the predicate of a spec

2017-09-22 Thread Beau Fabry
Not sure if I'm being glib here but #(s/valid? ::pm-hours %) returns a predicate that has the exact same results as #(s/int-in-range? 12 24 %) On Friday, September 22, 2017 at 1:10:51 PM UTC-7, Didier wrote: > > I'd try to call describe on the spec. As far as I know that's the only >

Re: Contribute Specter to Clojure core?

2017-02-14 Thread Beau Fabry
> The main thing that makes me hesitate to suggest this is getting bottlenecked on Clojure's dev process. Imo this is a big deal. I like the way specter has the ability to add new generally useful navigators and paths with new versions as people "discover" them, I don't think that's a great

Re: Simple clojure example improvements sought

2017-01-10 Thread Beau Fabry
e-vals person-num)})) (into {}))) (:name optij)) On Tuesday, January 10, 2017 at 6:13:28 PM UTC-8, hiskennyness wrote: > > > > On Tuesday, January 10, 2017 at 2:37:22 PM UTC-5, Beau Fabry wrote: >> >> With specter: >> >> (map-indexed (fn [i name]

Re: Simple clojure example improvements sought

2017-01-10 Thread Beau Fabry
sorry that last nth should've been (nth % i nil) On Tuesday, January 10, 2017 at 11:37:22 AM UTC-8, Beau Fabry wrote: > > With specter: > > (map-indexed (fn [i name] (sp/transform sp/MAP-VALS #(nth % i) optij)) > (:name optij)) > => ({:name :tom, :age 1, :tone :do} {:name

Re: Simple clojure example improvements sought

2017-01-10 Thread Beau Fabry
With specter: (map-indexed (fn [i name] (sp/transform sp/MAP-VALS #(nth % i) optij)) (:name optij)) => ({:name :tom, :age 1, :tone :do} {:name :dick, :age 2, :tone :re} {:name :harry, :age 3, :tone :mi}) Without: (map-indexed (fn [i name] (into {} (map (fn [[k v]] [k (nth v i)]) optij)))

Re: with-redefs does not work for macros

2016-10-31 Thread Beau Fabry
Not an answer to your question, but I usually just redefine clojure.tools.logging/log* instead for tests. On Monday, April 27, 2015 at 9:34:14 AM UTC-7, Vebjorn Ljosa wrote: > > In one of my tests, I was trying to mock something > (`clojure.tools.logging/warn`) that happened to be a macro. It

Re: clojure.spec.test/instrument causes clojure.spec/exercise-fn to use generators which fail the args spec!?

2016-10-20 Thread Beau Fabry
You have two possible branches for your ::fizbuzz arguments, a one-arity and a 3-arity. The 1-arity branch allows for the value 1, which when passed to the function fizzbuzz recursively calls the function fizzbuzz with the arguments (3 5 1) is not a valid set of values for ::fizzbuzz and so

Re: multi-spec and unqualified keys

2016-10-03 Thread Beau Fabry
Changing these two lines works, but I don't know whether it would cause other issues ``` (defmulti event-type :type) (s/def :event/event (s/multi-spec event-type :type)) ``` On Monday, October 3, 2016 at 4:01:32 AM UTC-7, Karol Hosiawa wrote: > > I don't know how to define multi-spec so that it

Re: core.async top use cases

2016-09-21 Thread Beau Fabry
You're probably right, I was confusing actors with agents. On Tuesday, September 20, 2016 at 7:05:19 PM UTC-7, Matan Safriel wrote: > > Actually, I am not sure clojure implements the actor model, which I can > only construe as the Erlang actor model here. I am almost certain the core > language

Re: core.async top use cases

2016-09-20 Thread Beau Fabry
I'm no expert on this, but the Actor model and the CSP model seem to be two different ways to model a concurrent system. Clojure supports them both. Personally I find the CSP model a simpler and easier to understand one than Actors, and so pretty much default to it. You might find non-clojure

Re: In clojure.spec, how to declare all valid keys in a map

2016-09-20 Thread Beau Fabry
boot.user=> (s/def ::my-map (s/and (s/keys :req [::a ::b]) (s/map-of #{::a ::b} any?))) boot.user=> (s/explain ::my-map {::a 1 ::b 2 ::BAD 3}) In: [:boot.user/BAD 0] val: :boot.user/BAD fails spec: :boot.user/my-map at: [0] predicate: #{:boot.user/a :boot.user/b} Seems better On Tuesday,

Re: How can I evaluate local symbols using eval function in Clojure?

2016-09-06 Thread Beau Fabry
Hi Philos, Without getting into how to implement this, the `spyscope` library and the `clojure.tools.logging` library implement this pattern in their `spy` macro and #spy/d reader literal respectively. So you could either add them to your development toolkit (recommended) or you could read

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-24 Thread Beau Fabry
Just specifically on a custom REPL printer, wouldn't that negate the benefits Alex sees in people becoming accustomed to reading spec error messages? If every error report from each different environment potentially looks different? Also, from the position of a community maintainer Brian is

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Beau Fabry
While I think the spec errors are pretty unfriendly, it's probably worth remembering that most of the times you'll get one you would have got an inscrutable ClassCastException or incorrect behaviour from a totally different place in the codebase prior to spec. It's definitely a huge

Re: Clojure spec screencast: Testing

2016-07-27 Thread Beau Fabry
On Wed, Jul 27, 2016 at 2:13 PM, Beau Fabry <imf...@gmail.com > > wrote: > >> With the passing test of `my-index-of`, is there any way to be confident >> that test.check generated inputs that checked the branch of the :fn spec >> where a return other than nil h

Re: Clojure spec screencast: Testing

2016-07-27 Thread Beau Fabry
With the passing test of `my-index-of`, is there any way to be confident that test.check generated inputs that checked the branch of the :fn spec where a return other than nil happened? All of the invocations of `exercise-fn` in the screencast only managed to get nil as a result. On Wednesday,

Re: Thoughts on clojure.spec

2016-07-19 Thread Beau Fabry
orrectly > oddly compelling, now that I’ve had some time to think about it and play > with it  > > > > Sean Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org > > > > *From: *Beau Fabry > *Sent: *Monday, July 18, 2016 8:50 PM >

Re: Thoughts on clojure.spec

2016-07-18 Thread Beau Fabry
ide, I also love the idea of the Clojure community fostering a > culture of gen testing each chunk of well defined functionality. If it's > truly achievable the Clojure community could become known as an unstoppable > force of robust code. > > > > It would be something of a c

Re: Thoughts on clojure.spec

2016-07-18 Thread Beau Fabry
> Do you find it frustrating that there's no way to turn on instrumentation of function outputs for manual testing? Yes. I've mentioned this elsewhere but I think being able to turn on output checking in lower environments (dev, test, master, staging) is getting extra values from specs

Re: Why does a call fail without type hints? (Understanding reflected calls)

2016-06-30 Thread Beau Fabry
My guess is the class generated by jnr-ffi can't be inspected with reflection for some reason or other, you should try poking at that sodium instance with http://clojure.github.io/clojure/branch-master/clojure.reflect-api.html in a repl and see what you get! In terms of "how expensive

Re: Spec of conform of spec

2016-06-20 Thread Beau Fabry
I think Alex's point was given any arbitrary function can be used as the conform part of the spec, this wouldn't be possible. Ie boot.user=> (s/conform (s/conformer inc) 1) 2 On Saturday, June 18, 2016 at 10:35:10 AM UTC-7, Leon Grapenthin wrote: > > I am not sure whether I understand what you

Re: clojure.spec

2016-05-27 Thread Beau Fabry
and > this makes me think on starting to split tests in test suites. Is there > something to handle this in clojure.test? > > Thanks! > > > On Thu, May 26, 2016 at 7:00 PM Beau Fabry <imf...@gmail.com > > wrote: > >> I'm in a similar position to you Wesley, I'm all

Re: clojure.spec

2016-05-26 Thread Beau Fabry
I'm in a similar position to you Wesley, I'm all for generative testing, but sometimes I prefer not to spec out the full depth of the tree (ie some input leaves with s/Any) and just turn on validation in staging and see what happens. The cpu-time wasted there doesn't matter much to me. Looking

Re: surprising behaviour from dissoc on records

2016-02-19 Thread Beau Fabry
Interesting. I think it makes sense in that `dissoc` is a function for removing a kv pair from a map, not a function for setting v to nil given a k. I could definitely see tripping up on this though. On Friday, February 19, 2016 at 8:07:16 AM UTC-8, Alex Miller wrote: > > You can find some of

Re: Java API type hint question

2016-01-26 Thread Beau Fabry
Tell the compiler that the type you're passing to the constructor is a Collection, so it will know which constructor to use without reflection. (set! *warn-on-reflection* true) => true (import '(java.util ArrayList Collection)) => java.util.Collection (ArrayList. (list 1 2)) Reflection warning,

Re: [ANN] Clojure 1.8.0-RC3

2015-12-14 Thread Beau Fabry
@Brian no, is an issue with reduce-fsm (which is fixed) https://github.com/cdorrat/reduce-fsm/issues/9 On Tuesday, December 15, 2015 at 9:42:01 AM UTC+11, Brian Marick wrote: > > Noam: does this mean it's not an issue with Midje? If it is, I'll look > into it. > > Noam Ben-Ari wrote: > >

Re: Self-referential gen-class usage

2015-11-25 Thread Beau Fabry
Forgive me for resurrecting a 7 year old thread, but is this still the solution? On Thursday, June 26, 2008 at 7:56:18 AM UTC-7, Chas Emerick wrote: > > At some point, I came to need to define a generated Java class that > had methods that returned instances of the class being generated. The

Re: how to make a function of a map argument ?

2015-10-23 Thread Beau Fabry
(map m [:a :b]) is a nice trick, we use it a lot in cascalog queries: (map ?account [:id :updated-at :created-at] :> ?id ?updated-at ?created-at) Where juxt would require more ceremony because of the need for serialization ((mapfn [m] ((juxt :id :updated-at :created-at) m)) ?account :> ?id

Re: defprotocol/deftype namespacing

2015-09-28 Thread Beau Fabry
I can't think of any (def* forms that allow you to specify a namespace, so imo it would be strange if they did. On Thursday, September 24, 2015 at 11:58:08 AM UTC-7, Gregg Reynolds wrote: > > Is there some compelling reason why deftype and defprotocol do not allow > specification of a

Re: No recent activity for core.async?

2015-09-28 Thread Beau Fabry
The docs have also diverged from the current official release, I'm looking forward to a new release :-) On Saturday, September 26, 2015 at 4:24:18 AM UTC-7, Gary Verhaegen wrote: > > That question has been asked recently and the official answer was that a > new release is coming "soon". There

Re: range function wrong in 1.7.0-beta?

2015-04-18 Thread Beau Fabry
Ouch. Suspect this is the problem https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LongRange.java#L161 Pretty sure that boolean should be round the other way. On Saturday, April 18, 2015 at 12:32:40 PM UTC-7, Mathias De Wachter wrote: Hi, this looks like quite a serious

Re: Where can one find low hanging fruit for open source contribution?

2014-10-09 Thread Beau Fabry
LightTable, the editor written in Clojurescript is currently looking for contributors, and have started tagging issues as beginner friendly. https://github.com/LightTable/LightTable On Saturday, September 27, 2014 4:34:19 PM UTC+10, kurofune wrote: I am an looking for a good, active, open

Re: Is this a reasonable use of core.async?

2014-09-18 Thread Beau Fabry
don't see anything particularly wrong with your way. On 18 Sep 2014 06:41, Beau Fabry imf...@gmail.com javascript: wrote: Larry your solution includes the cognitive overhead of another entire library and process model. future is part of core, and as I realised when Gary posted the doall's

Re: Is this a reasonable use of core.async?

2014-09-17 Thread Beau Fabry
is not important, I guess you could save some memory by using map and doall instead of mapv, though I doubt it would make any difference if you have only 4 sublists. Alternatively, have you looked at pmap ? On Wednesday, 17 September 2014, Beau Fabry imf...@gmail.com javascript: wrote: We don't have

Re: Is this a reasonable use of core.async?

2014-09-17 Thread Beau Fabry
16, 2014 10:00:07 PM UTC-4, Beau Fabry wrote: We don't have streams of data here, the long running tasks have side-effects. I would prefer to avoid adding another whole framework just to run a few long running jobs in p//. I have a list of jobs to do, I'm partitioning that list up into 4

Re: Is this a reasonable use of core.async?

2014-09-17 Thread Beau Fabry
solution. On Wednesday, September 17, 2014 8:48:09 PM UTC-4, Beau Fabry wrote: Thanks for that Larry but I think this is a bit of overkill for my scenario. The code I pasted is almost verbatim what we have in our production codebase, so the ability to queue new jobs etc is really

Re: Is this a reasonable use of core.async?

2014-09-16 Thread Beau Fabry
:46:02 AM UTC-4, Beau Fabry wrote: Is the kinda ugly constant (doall usage a sign that I'm doing something silly? (let [num-workers 4 widgets-per-worker (inc (int (/ (count widgets) num-workers))) bucketed-widgets (partition-all widgets-per-worker widgets) workers (doall

Is this a reasonable use of core.async?

2014-09-04 Thread Beau Fabry
Is the kinda ugly constant (doall usage a sign that I'm doing something silly? (let [num-workers 4 widgets-per-worker (inc (int (/ (count widgets) num-workers))) bucketed-widgets (partition-all widgets-per-worker widgets) workers (doall (map (fn [widgets]

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-02 Thread Beau Fabry
to postgres via odbc and run sql, and spinning up a repl inside of postgres that can dynamically define functions that play with the raw data On Wednesday, September 3, 2014 12:08:52 AM UTC+10, Jony Hudson wrote: On Tuesday, 2 September 2014 01:36:49 UTC+1, Beau Fabry wrote: Just a little bit

Re: Useless Java error messages

2014-09-02 Thread Beau Fabry
apologies, not a leiningen plugin. https://github.com/AvisoNovate/pretty On Wednesday, September 3, 2014 2:17:21 AM UTC+10, John Gabriele wrote: On Monday, September 1, 2014 7:24:54 PM UTC-4, Beau Fabry wrote: The pretty-errors leiningen plugin might be worth a look Hm... I don't see

Re: Using an atom for a caching map

2014-09-01 Thread Beau Fabry
intended for co-ordinating updates to multiple refs rather than as a synchronisation primitive on a single entity. I might be wrong though, as I say I've never used it. Cheers, Colin On 31 August 2014 00:58, Beau Fabry imf...@gmail.com javascript: wrote: I must be missing something, because

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Beau Fabry
Started looking into Gorilla for use at work today. Even prior to this release I was incredibly impressed. Amazing work everyone involved. On Monday, September 1, 2014 9:12:49 PM UTC+10, Jony Hudson wrote: Ohh, and there are some new docs on how to use Gorilla alongside your favourite

Re: Useless Java error messages

2014-09-01 Thread Beau Fabry
The pretty-errors leiningen plugin might be worth a look On Tuesday, September 2, 2014 7:58:31 AM UTC+10, g vim wrote: On 01/09/2014 17:50, Luc Prefontaine wrote: Where do you see a Java error here ? I see the Clojure implementation reporting that you are trying to apply a

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Beau Fabry
For what it's worth we're using Gorilla *after* leiningen. Leiningen is used to make an uberjar, but then we start the gorilla server in our own main. This is because we're running gorilla inside of our hadoop environment. This way we have a gorilla instance that can issue live cascalog

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Beau Fabry
Just a little bit of showing off of the previous post :-) http://i.imgur.com/zpfP9Ja.png On Tuesday, September 2, 2014 9:36:50 AM UTC+10, Beau Fabry wrote: For what it's worth we're using Gorilla *after* leiningen. Leiningen is used to make an uberjar, but then we start the gorilla server

Re: Macro that modifies the body of a function

2014-08-31 Thread Beau Fabry
This isn't a multimethod, it's a multiple-arity function. Anyway, you just need to detect that someone has tried to define a multiple arity method and change your definition accordingly. Something like below. I haven't actually tried this code so it's almost definitely wrong but you get the

Re: Macro that modifies the body of a function

2014-08-31 Thread Beau Fabry
) On Sunday, 31 August 2014 13:56:03 UTC+3, Beau Fabry wrote: This isn't a multimethod, it's a multiple-arity function. Anyway, you just need to detect that someone has tried to define a multiple arity method and change your definition accordingly. Something like below. I haven't actually tried

Re: Using an atom for a caching map

2014-08-30 Thread Beau Fabry
I must be missing something, because this is too simple? (defn get-maybe-cached [cache key] (dosync (if-let [v (get @cache key)] v (do (reset! cache (assoc @cache key (calculate key))) (get @cache key) On Saturday, August 30, 2014