clojure.spec - Rich on the Cognicast

2016-06-07 Thread Alex Miller
The Cognicast that was just released is Rich talking about clojure.spec so some people might be interested: http://blog.cognitect.com/cognicast/103 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegr

[ANN] Clojure 1.9.0-alpha5

2016-06-07 Thread Alex Miller
Clojure 1.9.0-alpha5 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha5 - Leiningen: [org.clojure/clojure "1.9.0-alpha5"] 1.9.0-alpha4 includes the following changes since 1.9

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-07 Thread Alex Miller
04) 302-SEAN > An Architect's View -- http://corfield.org/ > > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood > > > > On 6/7/16, 10:38 AM, "Alex Miller" a...@puredanger.com> wrote: > > > > C

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-07 Thread Alex Miller
Not sure, I can ask. I think BigDecimal is probably used way more than BigInteger. On Tuesday, June 7, 2016 at 8:52:36 PM UTC-5, Sean Corfield wrote: > > Whilst updating our code, I noticed there’s bigdec? to test for > java.math.BigDecimal but not bigint? or biginteger? > > > > Is there a spe

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-07 Thread Alex Miller
I don't know that anyone cares much, but I have done a new release of core.incubator (0.1.4) and deprecated seqable?. On Tuesday, June 7, 2016 at 1:21:34 PM UTC-5, Sean Corfield wrote: > > An excellent set of new predicates – thank you! > > > > Will clojure.core.incubator get a new release to r

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-08 Thread Alex Miller
r 30k+ lines of code where we can use bigdec? And there is also precisely >>> one place we could use biginteger? 😊 >>> >>> >>> >>> Sean Corfield -- (904) 302-SEAN >>> An Architect's View -- http://corfield.org >>> >>>

Re: No conform & throw variant in clojure.spec?

2016-06-08 Thread Alex Miller
I think different people will need slightly different things for this and it's pretty trivial to write, so not sure it's worth adding. Others have asked about it though. On Wednesday, June 8, 2016 at 8:19:31 AM UTC-5, Nikita Prokopov wrote: > > Hi! > > I noticed there’s no conform variant that t

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-09 Thread Alex Miller
I think it's quite likely that you have multiple copies of tools.analyzer (and possibly other libs) on your classpath. Can you take a look at your deps and see if that might be the case? A particular thing to watch for is if any dep is AOT compiled and transitively pulled in a dependency lib so

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-09 Thread Alex Miller
The use of named? inside spec will be replaced with ident?. On Wednesday, June 8, 2016 at 3:13:12 PM UTC-5, Devin Walters (devn) wrote: > > Any chance of `named?` making the cut in 1.9? I see it's used in the > implementation of clojure.spec. > > -- You received this message because you are sub

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-09 Thread Alex Miller
Whoops. That is an oversight. On Wednesday, June 8, 2016 at 11:34:13 AM UTC-5, David Powell wrote: > > > Do uri? and bytes? really have generator support implemented? I couldn't > seem to get that to work. > > -- You received this message because you are subscribed to the Google Groups "Clojur

Re: [ANN] Clojure 1.9.0-alpha5

2016-06-09 Thread Alex Miller
On Wednesday, June 8, 2016 at 3:23:51 AM UTC-5, Mamun wrote: > > Excellent set of new predicates. What about date predicate? > > It would be nice if there are also date predicate as an example in bellow > > date? > Use clojure.core/inst? > date-past? > date-future? > You can use the new cl

Re: clojure.spec and s/keys + s/fdef problem

2016-06-10 Thread Alex Miller
You want: (s/fdef command :args (s/cat :m (s/keys :req [::test]) :ret string?) :args takes a sequence of the arguments as if you were going to apply it. On Friday, June 10, 2016 at 7:58:10 AM UTC-5, Steen Larsen wrote: > > Hi, > > I am playing around with spec, and really like it

Re: clojure.spec: hard to generate sequential things

2016-06-10 Thread Alex Miller
sequential? is not really adding any value here - using a regex op will *only* match something that's sequential. The other thing to know here is that s/and creates a generator that generates based on the first spec, then filters based on the subsequent ones. So if you wanted to do sequences of

Re: Qualified keys, Clojure records, Spec

2016-06-11 Thread Alex Miller
This is a good question and one we've discussed a bit. You can use the existing s/keys with :req-un and :opt-un to spec the (unqualified) keys of a record - there's an example of this in the guide at http://clojure.org/guides/spec. So that's the short-term current answer. However, there are pot

Re: Bug (in Clojure 1.5): (fn [& xs] (pop xs)) throws ClassCastException clojure.lang.ArraySeq cannot be cast to clojure.lang.IPersistentStack

2016-06-11 Thread Alex Miller
Currently only vectors and lists implement the stack interfaces, not seqs. I do not think it makes sense for *all* seqs to implement the stack interface. It may not even make sense for any seqs to implement it, but I'd have to think about think about that for a while. Feel free to file an enhan

Re: Bug (in Clojure 1.5): (fn [& xs] (pop xs)) throws ClassCastException clojure.lang.ArraySeq cannot be cast to clojure.lang.IPersistentStack

2016-06-11 Thread Alex Miller
On Saturday, June 11, 2016 at 6:33:07 PM UTC-5, Fluid Dynamics wrote: > > On Saturday, June 11, 2016 at 6:55:03 PM UTC-4, Matching Socks wrote: >> >> pop isn't a sequence function. >> >> Check out the manual: >> http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/pop >>

Re: Bug (in Clojure 1.5): (fn [& xs] (pop xs)) throws ClassCastException clojure.lang.ArraySeq cannot be cast to clojure.lang.IPersistentStack

2016-06-11 Thread Alex Miller
On Sunday, June 12, 2016 at 1:15:23 AM UTC-5, Fluid Dynamics wrote: > > > All of that is very interesting, but then, by your own arguments (pop (seq > '(1 2 3))) should *not* work. > >From you prior post, I think you might be confused about what "seq" does as it doesn't "wrap" anything - it j

instrumenting clojure.core

2016-06-12 Thread Alex Miller
Yeah, I've been working on parts of this and there will be more to say in the future. -- 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 - pleas

Re: Bug (in Clojure 1.5): (fn [& xs] (pop xs)) throws ClassCastException clojure.lang.ArraySeq cannot be cast to clojure.lang.IPersistentStack

2016-06-12 Thread Alex Miller
On Sunday, June 12, 2016 at 9:12:08 AM UTC-5, Fluid Dynamics wrote: > > That misses the point that we have a core function that throws a > ClassCastException when passed (seq x) and not when passed (seq y). > (pop coll) works, (pop seq) does not. The fact that lists happen to act as a coll her

Re: instrumenting clojure.core

2016-06-12 Thread Alex Miller
On Sunday, June 12, 2016 at 9:22:24 AM UTC-5, Leon Grapenthin wrote: > > That looks great already. I'm also interested in what the official > workflow for adding specs to core is going to be and whether contributions > are desired. > Still much to be determined about this but I expect that spec

[ANN] core.async 0.2.382

2016-06-13 Thread Alex Miller
core.async 0.2.382 is now available. Try it via: [org.clojure/core.async "0.2.382"] 0.2.382 includes the following changes: - Change default dispatch thread pool max size to 8. - Add Java system property clojure.core.async.pool-size to override the dispatch thread pool max size - ASYNC-152 - d

Re: lazy-cat's memoization obscuring runtime exceptions

2016-06-13 Thread Alex Miller
I'm not aware of a ticket on it, feel free to file one. tryclj dumps your session periodically and you'll lose any vars you've defined. On Monday, June 13, 2016 at 3:27:54 PM UTC-5, Sebastian Oberhoff wrote: > > The following lines are copied straight from tryclj.com > > > (def expexp (lazy-cat

Re: instrumenting clojure.core

2016-06-14 Thread Alex Miller
I was suggesting that you could do something like this (although I'm pretty sure this doesn't work right now): (s/fdef map :args (s/cat :f (s/fspec :args (s/+ ::s/any)) :colls (s/* seqable?)) :ret (s/or :seq seqable? :transducer ifn?) :fn #(if (zero? (count (-> % :args :colls

Re: Automatically upversioning a project in continuous integration?

2016-06-14 Thread Alex Miller
On Tuesday, June 14, 2016 at 5:21:04 AM UTC-5, Simon Brooke wrote: > > Apologies if this is a FAQ, I have done a number of searches and not found > anything. > > I see that the Clojure project's internal Hudson CI server does automatic > upversioning on release builds (see documentation here >

[ANN] Clojure 1.9.0-alpha6

2016-06-14 Thread Alex Miller
Clojure 1.9.0-alpha6 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha6 - Leiningen: [org.clojure/clojure "1.9.0-alpha6"] 1.9.0-alpha6 includes the following changes since 1.9.0-alpha5: - & regex op now fails fast when regex passes but preds

Re: [ANN] New clojure.org!

2016-06-14 Thread Alex Miller
59 PM UTC-5, Alan Thompson wrote: > > Alex - I could not find a link to the Clojure.org github project on the > clojure.org site. Should one be added under "Contributing" somewhere? > Alan > > On Thursday, January 14, 2016 at 7:45:06 AM UTC-8, Alex Miller wrote: >>

Re: [ANN] New clojure.org!

2016-06-14 Thread Alex Miller
Shoot, that was not the link I meant. I meant: http://clojure.org/community/contributing_site On Tuesday, June 14, 2016 at 4:33:14 PM UTC-5, Alex Miller wrote: > > Well there's a whole page about it at the link mentioned in the message > below - https://github.com/clojure/cloj

Re: clojure.spec regression bug for 1.9.0-alpha6

2016-06-14 Thread Alex Miller
As noted in the alpha change list, this was an intentional change in what instrument does. Instrument is intended to be used to verify that other callers have invoked a function correctly. Checking that the function works (by verifying that :ret and :fn return valid results) should be done using

Re: clojure.spec(1.9.0-alpha6): Is this the expected return value from (s/gen (s/alt ...)) ?

2016-06-14 Thread Alex Miller
It is. By using s/alt, you are inherently matching a sequential collection. You probably want s/or in this case instead. On Tuesday, June 14, 2016 at 11:15:40 PM UTC-5, Joseph Wayne Norton wrote: > > Is this the expected return value? > > => (gen/sample (s/gen (s/alt :s string? :b boolean?))) >>

How to spec a plain map with exclusive groups of :req keys?

2016-06-15 Thread Alex Miller
Because spec embraces the idea of open maps, there is no provided support for checking that keys don't exist. To get this behavior you will need to use a custom predicate (probably s/and with s/keys to get its other checks). -- You received this message because you are subscribed to the Google

spec.gen for uri?

2016-06-15 Thread Alex Miller
My own hammock time on this led me to believe that in most cases where users care about what uris they are testing, a custom generator will be required. There are very few applications that actually expect a wide variety of uri forms, so I saw no point in spending a lot of effort in producing th

Re: clojure.spec regression bug for 1.9.0-alpha6

2016-06-15 Thread Alex Miller
I'm in the process of updating that part of the guide right now, should be done by end of day. On Wednesday, June 15, 2016 at 12:30:55 PM UTC-5, webber wrote: > > Maybe, the following is the same reason. > > ``` > (defn ranged-rand ;; BROKEN! > "Returns random integer in range start <= rand <

Re: In what sense does "coll-of" not flow conformed values?

2016-06-15 Thread Alex Miller
On Wednesday, June 15, 2016 at 1:36:54 PM UTC-5, Oded Badt wrote: > > From https://clojure.org/guides/spec#_collections: > *One important aspect of coll-of and map-of is that they both sample their > inputs, checking only a subset of the values for performance reasons. Due > to this, conform of

[ANN] Clojure 1.9.0-alpha7

2016-06-15 Thread Alex Miller
Clojure 1.9.0-alpha7 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha7 - Leiningen: [org.clojure/clojure "1.9.0-alpha7"] 1.9.0-alpha7 includes the following changes since 1.9.0-alpha6 (all BREAKING vs alpha5/6): clojure.core: - long? => in

Re: [ANN] Clojure 1.9.0-alpha6

2016-06-15 Thread Alex Miller
I miss that feature already, > hehe, although I understand that these are alpha versions and things evolve. > :) I just want to understand the context behind this decision. If I missed > relevant discussion already explaining this, I apologize. > >> On Tuesday, June 14,

Re: [ANN] Clojure 1.9.0-alpha6

2016-06-16 Thread Alex Miller
, 2016 at 10:17:43 PM UTC-5, adrian.med...@mail.yu.edu wrote: > > Thanks for the link Alex. I understand what changed, but I still don't > understand why. Could you elaborate on the thought that went into this? > Thank you. > > On Wednesday, June 15, 2016 at 7:37:52 PM U

Re: clojure.spec regression bug for 1.9.0-alpha6

2016-06-16 Thread Alex Miller
You haven't pretty-printed it to look very nice, but I think all of the same information (and more due to shrinking) is still in the check-var output. I don't know of any plan to add what you're asking for beyond what's below. {:result {:clojure.spec/problems {[] {*:pred* *(>= (:ret %) (-

Re: Specs for clojure.core (very unofficial)

2016-06-16 Thread Alex Miller
On Thursday, June 16, 2016 at 6:11:19 PM UTC-5, Leif wrote: > > I’m having fun playing with clojure.spec, and I’ve written specs for most > fns in clojure.core > and 1/3rd of the macros (WIP). Here they are in case you want to play > along: > > https://github.com/leifp/spec-play > > Bear in min

[ANN] core.async 0.2.385

2016-06-17 Thread Alex Miller
core.async 0.2.385 is now available. Try it via: [org.clojure/core.async "0.2.385"] 0.2.385 includes the following changes: - bump dependency on clojure.tools.analyzer.jvm to latest -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: clojure.spec regression bug for 1.9.0-alpha6

2016-06-17 Thread Alex Miller
fn, but we run-all-tests > just passes println in and calls (prn ret) on the result of check-var so we > have no control over that output. > > > > Sean Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > > "If you're not annoying s

Re: clojure.spec - dynamic specs

2016-06-17 Thread Alex Miller
On Friday, June 17, 2016 at 2:46:37 PM UTC-5, Brian Platz wrote: > > > I'd like to be able to use clojure.spec for input validation where the > specs are stored in a database using a data structure to represent them. > Why don't you represent them as code loaded by different applications? s/fo

Re: Spec of conform of spec

2016-06-18 Thread Alex Miller
Given that conform takes an arbitrary (opaque) function, I don't think that's generically possible. On Saturday, June 18, 2016 at 7:37:33 AM UTC-5, Leon Grapenthin wrote: > > Assume I parse with conform. > > Then I have functions that operate on the value returned by conform. I > want to spec

Re: Why we cannot do this now?

2016-06-19 Thread Alex Miller
This is a nice trick and its one I have done myself on Clojure CLIs (particularly with "help" options) to defer loading and give a faster feel to startup. It is great to have a repl that starts super fast for people learning Clojure to get started, or to spin one up to try something. However, t

Re: clojure.string unexpected behaviors

2016-06-21 Thread Alex Miller
There are some comments at the top of clojure.string (http://clojure.github.io/clojure/#clojure.string) about expected usage. In particular, you should expect all clojure.string functions to accept CharSequence (a parent interface of String, StringBuffer, and StringBuilder and return the same (

Re: clojure.string unexpected behaviors

2016-06-21 Thread Alex Miller
On Tuesday, June 21, 2016 at 2:45:45 PM UTC-5, Sean Corfield wrote: > > Alex gave you a correct (but fairly short) answer. I’d like to expand on > it a bit, partly in light of a certain recent blog post, partly because of > a personal “hot button”… > > This is going to be along the same lines as

Re: [ANN] core.async 0.2.382

2016-06-23 Thread Alex Miller
a bash script to > calculate our threadpool size before starting up. > > Perhaps I’m missing something really obvious here, if so, please let me > know :) > > Tim Ewald, can you help with this? > > On Tue, Jun 14, 2016 at 9:10 AM Fluid Dynamics wrote: > >> On Mon

Re: clojure.spec explain feedback

2016-06-27 Thread Alex Miller
There have been a lot of changes in map-of and coll-of for the next alpha, in particular map-of and coll-of now conform all elements, which changes what has been surprising behavior to many people both during conforming and explain due to sampling (which has moved to the new every and every-kv).

[ANN] Clojure 1.9.0-alpha8

2016-06-28 Thread Alex Miller
Clojure 1.9.0-alpha8 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha8 - Dependency: [org.clojure/clojure "1.9.0-alpha8"] 1.9.0-alpha8 includes the following changes since 1.9.0-alpha7: The collection spec support has been greatly enhanced,

Re: [ANN] Clojure 1.9.0-alpha8

2016-06-28 Thread Alex Miller
lection is checked. Additionally, there is an every? in clojure.core > which does check a predicate for every value in the collection. > > I (loosely) suggest sample and sample-kv as other names, but am not 100% > sure I like them. > > Thoughts? > > On Wed, Jun 29, 2016 at 10

Re: [ANN] Clojure 1.9.0-alpha8

2016-06-28 Thread Alex Miller
namespaced keyword changes? > > On 29 June 2016 at 11:48, Leon Grapenthin > wrote: > >> This is fantastic. Spec really seems to turn out like a "killer-feature" >> for Clojure. >> >> On Wednesday, June 29, 2016 at 12:13:25 AM UTC+2, Alex Miller wrote: &

Re: [ANN] Clojure 1.9.0-alpha8

2016-06-28 Thread Alex Miller
I've updated the spec guide for Clojure 1.9.0-alpha8 and I will add some more to it later about s/merge and probably some on the new instrument mock/stub capabilities. http://clojure.org/guides/spec Alex On Tuesday, June 28, 2016 at 5:13:25 PM UTC-5, Alex Miller wrote: > > Cl

Re: [ANN] Clojure 1.9.0-alpha8

2016-06-29 Thread Alex Miller
il 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 1.9.0-alpha8 is now available. >> >> Try it via >> >

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

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 of

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/& (s/keys

Re: restricting test check input size

2016-07-04 Thread Alex Miller
This is a common problem with data generators (whether test.check or any other generator I know of). In general the problem of "giving me random (but not ridiculous) data that will also effectively act as a test" is hard. test.check has a number of controls that can be applied; spec exposes som

Re: restricting test check input size

2016-07-04 Thread Alex Miller
the specs, but you could also supply them as overrides in calls to s/gen or in calls to stest/test. On Monday, July 4, 2016 at 3:17:59 PM UTC-5, Alex Miller wrote: > > This is a common problem with data generators (whether test.check or any > other generator I know of). In general

Customizing error messages reported by spec.explain

2016-07-05 Thread Alex Miller
explain-data is designed to return you sufficient information to detect any specific problem or create any error message you like and so there are no plans at this time to provide additional customization options in spec. Explain-data gives you a list of problems and for each problem, the path i

Re: clojure.spec regression bug for 1.9.0-alpha6

2016-07-05 Thread Alex Miller
There is nothing provided or planned to do that. On Tuesday, July 5, 2016 at 8:43:31 AM UTC-5, Nikita Prokopov wrote: > > How to I make spec/fdef and regular clojure.test (not generative ones) > work together? I’d like for my :ret specs and HOF :ret specs to be checked > during regular tests. I

[ANN] Clojure 1.9.0-alpha9

2016-07-05 Thread Alex Miller
Clojure 1.9.0-alpha9 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha9 - Leiningen: [org.clojure/clojure "1.9.0-alpha9"] 1.9.0-alpha9 includes the following changes since 1.9.0-alpha8: - NEW clojure.spec/assert - a facility for adding spec

Re: [ANN] Clojure 1.9.0-alpha9

2016-07-05 Thread Alex Miller
/clojure/WiMV5EEAVhM> and here > <http://stackoverflow.com/q/38151446/5044950>) in the future? > > On Tuesday, July 5, 2016 at 3:50:47 PM UTC-4, Alex Miller wrote: >> >> Clojure 1.9.0-alpha9 is now available. >> >> Try it via >> >> - Download

Re: [ANN] Clojure 1.9.0-alpha9

2016-07-06 Thread Alex Miller
This is the correct behavior. The :or map keys are always the local names being bound (not the keys being looked up in the map). > On Jul 6, 2016, at 4:40 AM, Leon Grapenthin wrote: > > Another small bug report: > > (let [{:keys [a/b] :or {a/b 42}} {}] > b) > > Evaluates to nil, but should

Re: [ANN] Clojure 1.9.0-alpha9

2016-07-06 Thread Alex Miller
Thanks! If I could trouble you to make a jira for that, would love to get it fixed. > On Jul 6, 2016, at 4:09 AM, Leon Grapenthin wrote: > > Small bug report > > Throwable->map in core_print.clj doesn't handle Throwable.getCause returning > null in L463. This results in a NPE in StrackTraceEl

Re: [ANN] Clojure 1.9.0-alpha9

2016-07-06 Thread Alex Miller
This *is* different than 1.8 (and prior) because it has been buggy since namespaced keys were added (due to a lack of tests - entirely my fault). Nothing was ever documented about this behavior - it was purely accidental and I would consider it in the realm of "unspecified". In 1.9 I added addi

Re: [ANN] Clojure 1.9.0-alpha9

2016-07-06 Thread Alex Miller
gt; keys in 1.8 I believe that many people will have tried adding the ns and > ran with it. > > > On Wednesday, July 6, 2016 at 2:17:14 PM UTC+2, Alex Miller wrote: >> >> This *is* different than 1.8 (and prior) because it has been buggy since >> namespaced keys were ad

[ANN] Clojure 1.9.0-alpha10

2016-07-11 Thread Alex Miller
Clojure 1.9.0-alpha10 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha10 - Leiningen: [org.clojure/clojure "1.9.0-alpha10"] 1.9.0-alpha10 includes the following changes since 1.9.0-alpha9: - NEW clojure.core/any? - a predicate that matches

Re: Rationale for `keys` not supporting vectors?

2016-07-11 Thread Alex Miller
As background re the collection model: http://insideclojure.org/2016/03/16/collections/ Keys and vals are both defined as functions that take a seqable of map entries. Given that definition, it is not easily possible to widen it to also take a collection with the associative trait, because a co

Re: Clojure 1.9.0-alpha10: Semantic mismatch: any? vs not-any?

2016-07-11 Thread Alex Miller
ge would help to keep Clojure in line with users > instincts and assumptions, as well as past Clojure practices. I have often > felt that one of the most important principles in any sort of software > development is adherence to the Principle of Least Astonishment > <https://en.wik

Re: Is it possible / is support planned to add docstrings to clojure.spec specs?

2016-07-12 Thread Alex Miller
It's under consideration. On Thursday, June 2, 2016 at 1:39:12 AM UTC-5, Russell wrote: > > Just been trying out clojure.spec for the first time, looks really nice. > It would be good to be able to do something like the following: > > (clojure.spec/def > "The name of the stage, which API Gatewa

Clojure spec screencast: Leverage

2016-07-13 Thread Alex Miller
Check out the first in a series! http://blog.cognitect.com/blog/2016/7/13/screencast-spec-leverage -- 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 mode

Re: Use latest Clojure with lein repl

2016-07-13 Thread Alex Miller
You might need to upgrade your Java version as well to have newer CAs to authenticate SSL to download lein! Check java -version and JAVA_HOME. I would say *don't* do https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#replacing-default-repl-dependencies - that's more likely to

clojure.spec guide

2016-07-13 Thread Alex Miller
Back when we released spec we also released the spec guide at http://clojure.org/guides/spec. I have been updating this guide for each alpha and also adding new sections. If you haven't looked at it in a while, you might find it worth looking again. Some things that have been added since the e

Re: Clojure 1.9.0-alpha10: Semantic mismatch: any? vs not-any?

2016-07-15 Thread Alex Miller
On Friday, July 15, 2016 at 2:27:56 PM UTC-5, Atamert Ölçgen wrote: > > > I can't think of a single use case where this function would be useful. I > would either inline true instead of a function call, or I would supply > (constantly true) if a function is expected. > > I am sure it wouldn't be

Re: The Language of IoT is Clojure

2016-07-18 Thread Alex Miller
Great work! On Monday, July 18, 2016 at 9:16:58 AM UTC-5, Gregg Reynolds wrote: > > Hi list, > > The competition phase of the Intel Ultimate Coder Challenge for IoT > drew to a close last Friday. Final > reports are now online. > > Clojure played a starring rol

Re: Clojure 1.9.0-alpha10: Semantic mismatch: any? vs not-any?

2016-07-18 Thread Alex Miller
ry? to have > determiners such as every, some, any as names. > > Logan > > On Wednesday, July 13, 2016 at 6:15:14 AM UTC-4, Tassilo Horn wrote: >> >> Alex Miller writes: >> >> Hi Alex, >> >> > Well, there are only so many words. >>

clojure.spec from returns object instaced of data for every-kv

2016-07-19 Thread Alex Miller
This is a bug. I'm actually looking at it (and some other form bugs right now). -- 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 - please be pa

Re: clojure.spec merge is excellent, but do you consider dissoc spec for keys?

2016-07-19 Thread Alex Miller
Well first I'd say it's actually more important here that you are reusing the attribute specs for ::fname ::lname etc across front and back. And second, perhaps you should be breaking out the common parts into a spec you can reuse instead: (s/def ::person-shared-spec (s/keys ::req-un [::fname :

Re: Recursive clojure.spec doesn't work

2016-07-20 Thread Alex Miller
s/spec is going to try to resolve that keyword during the definition. Does this do what you want? (s/def :html/element (s/spec (s/cat :tag keyword? :attrs map? :children (s/* (s/alt :element :html/element

Re: Enhance spec/double-in to handle open and half-open intervals?

2016-07-20 Thread Alex Miller
You can file a jira if you like, I'm not sure Rich's thoughts on this. Also, keep in mind that you can also compose preds and get this with slightly more effort now: (s/and (s/double-in :min 0.0 :max 1.0) #(not= 0.0 %)) On Wednesday, July 20, 2016 at 2:03:28 PM UTC-5, Mars0i wrote: > > cloj

Re: Enhance spec/double-in to handle open and half-open intervals?

2016-07-20 Thread Alex Miller
On Wednesday, July 20, 2016 at 9:41:59 PM UTC-5, Mars0i wrote: > > On Wednesday, July 20, 2016 at 4:32:40 PM UTC-5, Alex Miller wrote: >> >> You can file a jira if you like, I'm not sure Rich's thoughts on this. >> > > I understand. Thanks--will do.

Re: Enhance spec/double-in to handle open and half-open intervals?

2016-07-21 Thread Alex Miller
You can already get open intervals by just omitting :min or :max. On Thursday, July 21, 2016 at 8:50:21 AM UTC-5, miner wrote: > > With a little help from Java, you can make equivalent open intervals for > the desired bounds. For example, > > (s/and (s/double-in :min 0.0 :max 1.0) #(not= 0.0

Re: fspec requires dependency on test.check

2016-07-21 Thread Alex Miller
Hi Joe, This is an area of ongoing work and the following ticket captures this issue as well: http://dev.clojure.org/jira/browse/CLJ-1936 (and duped http://dev.clojure.org/jira/browse/CLJ-1976) Spec by itself should not require a test.check dependency. Alex On Thursday, July 21, 2016 at 11:

Re: Future of spec/explain-data, spec/and, etc.

2016-07-24 Thread Alex Miller
On Sunday, July 24, 2016 at 10:40:41 PM UTC-5, Mars0i wrote: > > spec/explain-data seems very important. It allows programmatic responses > to spec failures. Maybe explain-data's behavior hasn't yet stabilized, > though? The structure of the return value has changed between 1.9.0-alpha7 > t

Re: Arity count

2016-07-25 Thread Alex Miller
It might be helpful to back up a step and explain why you need to do this? On Monday, July 25, 2016 at 10:14:16 AM UTC-5, Riccardo Di Meo wrote: > > Hi! > > It's a *very* old thread, but is there any news about this? I mean, is > there a way to find the list of accepted arities of an anonymous fu

Clojure spec screencast: Testing

2016-07-27 Thread Alex Miller
Check out the 2nd screencast about spec, this time on testing with check and instrument: http://blog.cognitect.com/blog/2016/7/26/clojure-spec-screencast-testing -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Re: Can we provide examples in fdef?

2016-07-28 Thread Alex Miller
Hi Frank, We don't plan to do anything like this. This would be adding a secondary function to spec.test/check that's not really its goal. Alex On Wednesday, July 27, 2016 at 5:13:55 PM UTC-5, Frank Liu wrote: > > Hi All, > > Not sure if this is helpful or taking it too far, but often when I w

Re: intern with :dynamic - either a bug or undocumented behavior?

2016-07-30 Thread Alex Miller
I think there are differences here due to the two mechanisms for treating a Var as dynamic. This reminds me of the ticket http://dev.clojure.org/jira/browse/CLJ-859 as well. I'm not sure what the proper resolution should be as there are several ways to go with it. On Saturday, July 30, 2016 a

Re: How to restrict the number of test with stest/check

2016-08-03 Thread Alex Miller
As the docstring for check notes: "The opts map includes the following optional keys, where stc aliases clojure.spec.test.check: ::stc/opts opts to flow through test.check/quick-check :genmap from spec names to generator overrides" So the opts map would be like: (stest/check `myfunc {:

Re: clojure.spec for specifying sequences of states over time

2016-08-05 Thread Alex Miller
There are a variety of possible extensions to what is currently offered by spec wrt regex derivatives but that's up to Rich. On Friday, August 5, 2016 at 12:37:15 PM UTC-5, Russell Mull wrote: > > Suppose you have a reactive process, something that receives a message, > processes it, updates it

Re: Why (first [*' *]) instead of just *?

2016-08-05 Thread Alex Miller
I believe your guess is right - this is a hack to work with older versions (pre 1.3) of Clojure where the reader didn't support ' as a constituent character in symbols. On Friday, August 5, 2016 at 12:28:08 PM UTC-5, Shannon Severance wrote: > > Lines 57--62 of > https://github.com/clojure/mat

Re: Keep application running when main thread only starts go blocks

2016-08-06 Thread Alex Miller
I think this is solution is fine. A single channel is not going to use any noticeable resources. You've basically created a latch - there are several latch-like things built into Java you can use as well. In the main thread you could do: (let [signal (java.util.concurrent.CountDownLatch. 1)]

Re: Meta-data should be added to deprecated functions?

2016-08-09 Thread Alex Miller
There are really two aspects to this - one is actually including the metadata in core.async, which can definitely be done. The second is adding functionality to Clojure core to give you more feedback about deprecated functions and that's something I've been trying to push through to completion

Re: Meta-data should be added to deprecated functions?

2016-08-09 Thread Alex Miller
st 9, 2016 at 11:49:36 PM UTC+3, Alex Miller wrote: >> >> There are really two aspects to this - one is actually including the >> metadata in core.async, which can definitely be done. >> >> The second is adding functionality to Clojure core to give you more >>

Re: I've found a constellation of related bugs in primitive function support when type-hinting *return types*.

2016-08-09 Thread Alex Miller
What Clojure version are you using? On Tuesday, August 9, 2016 at 5:01:21 PM UTC-5, Fluid Dynamics wrote: > > => (defn foo [x] (doto (double-array 1) (aset 0 x))) > => [(foo 3.0) (type (foo 3.0))] > [[3.0] [D] ; As expected, a double array with the value passed in. > ; Maybe a good idea to hint th

Re: Meta-data should be added to deprecated functions?

2016-08-10 Thread Alex Miller
In this case, there is not a specific function to point to, rather the use of a transducer with a chan is the alternative. -- 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 f

Re: Why doesn't reduce return a transducer

2016-08-10 Thread Alex Miller
I think you're really talking about reductions, not reduce. In sequence form, like: user=> (reductions + [0 1 2 3 4 5]) (0 1 3 6 10 15) There is not currently a reductions transducer although there is a ticket proposing to add one: http://dev.clojure.org/jira/browse/CLJ-1903 You don't have to

[ANN] clojurescript.org

2016-08-15 Thread Alex Miller
We are pleased to announce that http://clojurescript.org is now a site rather than a redirect to the github repo. Content was seeded from the CLJS wiki. The site contribution process is the same as http://clojure.org - Contributor Agreement is required, but then contributions can be sent via P

Re: dynamically building a vector of hashmaps, or is there a better way to achieve the same result?

2016-08-16 Thread Alex Miller
On Tuesday, August 16, 2016 at 2:02:38 PM UTC-5, cptu...@gmail.com wrote: > > Hello fellow Clojurists, > > I have just started learning Clojure is a side project in a Java bootcamp > at The Iron Yard. I am tackling a project that I think will require a > dynamically built vector of hashmaps.

fdef for defmulti?

2016-08-18 Thread Alex Miller
There are several kinds of functions that can't currently be spec'ed (primitive, interned, maybe protocol fns?, multi methods). Some of those will ultimately be fixed, some (interned) will probably not. -- You received this message because you are subscribed to the Google Groups "Clojure" group

fdef for defmulti?

2016-08-18 Thread Alex Miller
I should mention that a half step is to spec the dispatch function used by the multimethod. That covers the front-end. -- 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

<    1   2   3   4   5   6   7   8   9   10   >