Re: [ANN] walmartlabs/datascope 0.1.0

2016-06-29 Thread Alan Moore
+1 Thanks for this! Alan On Monday, June 27, 2016 at 10:57:56 AM UTC-7, Howard M. Lewis Ship wrote: > > > A library that can be used to render typical Clojure data structures using > Graphviz. > > https://github.com/walmartlabs/datascope > > -- > Howard M. Lewis Ship > > Senior Mobile

Re: clojure.spec - s/and interferes with regular expressions

2016-06-29 Thread Sean Corfield
Using s/& and Mark’s fdef does “work” but the failure messages seem misleading: boot.user=> (f 2 :even 4) nil boot.user=> (f 2 :even 3) clojure.lang.ExceptionInfo: Call to #'boot.user/f did not conform to spec:     val: () fails at: [:args :options] predicate: (&

Re: clojure.spec - s/and interferes with regular expressions

2016-06-29 Thread Alex Miller
As soon as you introduce the s/and, you have dropped out of regex land and into a predicate. You are then matching something in a new nested regex inside the and like: [[::even 4]]. To stay within the top-level regex and supply extra predicates, use s/& instead: (s/def ::options (s/&

clojure.spec - s/and interferes with regular expressions

2016-06-29 Thread Mark Engelberg
I'm having trouble spec'ing out something like this, a function that takes an integer as an input followed by a series of optional keyworded args. :even is an allowed optional keyword, but we definitely want to forbid :odd as an optional keyword. (s/def ::even even?) (s/def ::options (s/and

Learning Google's Map Reduce with Clojure

2016-06-29 Thread Olek
Hi! I was refreshing my knowledge from Google's Map Reduce. I've decided to code some examples in Clojure since it is my favorite language. Here is the code from the learning process https://github.com/naleksander/mapreduce I guess that it is time now to code it in Scala *wink* Btw. if I were

Re: [ANN] clojure-future-spec, a backport of clojure.spec for 1.8

2016-06-29 Thread Sean Corfield
On 6/29/16, 10:03 AM, "Lucas Bradstreet" wrote: > Sean, a lot of library developers still want to support Clojure 1.8, > but this would prevent using spec with their projects. clojure.java.jdbc solves that by having the specs in a

Re: [ANN] clojure-future-spec, a backport of clojure.spec for 1.8

2016-06-29 Thread Lucas Bradstreet
This looks great Nikita. Sean, a lot of library developers still want to support Clojure 1.8, but this would prevent using spec with their projects. This would help there. Onyx in particular was going to avoid using spec for the time being, but we may re-evaluate now. On 30 June 2016 at 00:31,

Re: [ANN] clojure-future-spec, a backport of clojure.spec for 1.8

2016-06-29 Thread Sean Corfield
Interesting idea. If you’re already on Clojure 1.8, I think it’s pretty safe to upgrade to the Alpha builds of 1.9. We’re running 1.9 Alpha 7 in production at the moment (and will move to Alpha 8 in our next build after today). The only glitches we ran into were name collisions in

Re: clojure.spec Invalid token error from different namespace when specs are registered with number

2016-06-29 Thread Alex Miller
According to the reader page (http://clojure.org/reference/reader), keyword names can't start with a number. However, unqualified keywords that start with a number have (accidentally) worked for a long time and we have effectively grandfathered them in. You're seeing some of the ragged edges

Re: clojure.spec Invalid token error from different namespace when specs are registered with number

2016-06-29 Thread Leon Grapenthin
I believe that this is a problem with how the reader resolves aliased keywords as the problem can be reproduced without spec. You should file a JIRA ticket. On Wednesday, June 29, 2016 at 9:22:49 AM UTC+2, Mamun wrote: > > Hi, > > Invalid token error from different namespace when specs are

Re: clojure.spec Invalid token error from different namespace when specs are registered with number

2016-06-29 Thread Leon Grapenthin
Have isolated more: Namespaced keywords with numbers in the name all don't work, but when using double-colon syntax they can be fabricated. :a/1 -> RuntimeException Invalid token: :a/1 clojure.lang.Util.runtimeException (Util.java:221) :user/1 -> RuntimeException Invalid token: :a/1

Re: [ANN] Clojure 1.9.0-alpha8

2016-06-29 Thread Simon Belak
Missed that s/nilable exists. Cheers.  On 29 June 2016 at 16:04:05, Alex Miller (a...@puredanger.com) wrote: Also, you can turn any predicate into a nil-accepting predicate with s/nilable. user=> (s/valid? (s/nilable (s/every ::s/any)) nil) true On Wednesday, June 29, 2016 at 9:02:43 AM

Re: [ANN] Clojure 1.9.0-alpha8

2016-06-29 Thread Alex Miller
Also, you can turn any predicate into a nil-accepting predicate with s/nilable. user=> (s/valid? (s/nilable (s/every ::s/any)) nil) true On Wednesday, June 29, 2016 at 9:02:43 AM UTC-5, Alex Miller wrote: > > user=> (s/explain (s/every ::s/any) nil) > val: nil fails predicate: coll? > >

Re: [ANN] Clojure 1.9.0-alpha8

2016-06-29 Thread Alex Miller
user=> (s/explain (s/every ::s/any) nil) val: nil fails predicate: coll? indicates that s/every (also s/coll-of) validate using coll? as the predicate and coll? (like most type predicates) does not validate nil. nil punning is more often done for sequences. Sequences with structure are

Re: [ANN] Clojure 1.9.0-alpha8

2016-06-29 Thread Simon Belak
map-of now conforming is fantastic news! One question though: why doesn't every validate when given nil for collection? Seems inconsistent given pervasive nil punning elsewhere and that [] validates. s On Wednesday, June 29, 2016 at 12:13:25 AM UTC+2, Alex Miller wrote: > > Clojure

[ANN] clojure-future-spec, a backport of clojure.spec for 1.8

2016-06-29 Thread Nikita Prokopov
Hi! Not sure if a good idea or bad, but if you were eager to play with latest version of clojure.spec but don’t want to upgrade your production to alpha version of the language, you can add clojure.spec capabilities as a library to 1.8: https://github.com/tonsky/clojure-future-spec

clojure.spec Invalid token error from different namespace when specs are registered with number

2016-06-29 Thread Mamun
Hi, Invalid token error from different namespace when specs are registered with number Example ;one.clj (s/def ::a string?) (s/def ::1 int?) ::1 ;Ok ::a ;Ok ;one-test.clj :one/1 ;; Error :one/a ;;Ok ;(gen/sample (s/gen ::1)) ;(gen/sample (s/gen ::a)) I am not sure, it is bug or