Added truss to validation-benchmark

2016-06-15 Thread Atamert Ölçgen
Hi,

Peter Taoussanis was kind enough to contribute truss implementation to
validation-benchmark.

I have run it (with a few

upgrades

to

other

dependencies) and updated the report page.

-

Personal note: truss is faster than anything else. Much faster. How can
this be? It can't be an issue of no-op. Because the wrapper
(validation-benchmark.lib.truss/wrapper) is calling the given function. And
validation-benchmark.core/prepare-benchmark-for-lib wraps the benchmark
function with an assertion on the result (true for valid, false for
invalid). Either we have a bug or I am justified to be in awe.


-- 
Kind Regards,
Atamert Ölçgen

◻◼◻
◻◻◼
◼◼◼

www.muhuk.com

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Clojure 1.9.0-alpha6

2016-06-15 Thread adrian . medina
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 UTC-4, Alex Miller wrote:
>
> Check out the thread at 
> https://groups.google.com/forum/m/#!topic/clojure/RLQBFJ0vGG4
>
> On Jun 15, 2016, at 5:22 PM, adrian...@mail.yu.edu  wrote:
>
> I was wondering if you could shed some light on why instrument was changed 
> to not automatically check the :ret and :fn specs. 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, 2016 at 1:31:25 PM UTC-4, Alex Miller wrote:
>>
>> 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 do not
>> - returns from alt/or are now map entries (supporting key/val) rather 
>> than 2-element vector
>> - [BREAKING] fn-specs was renamed to fn-spec and returns either the 
>> registered fspec or nil
>> - fspec now accepts ifn?, not fn?
>> - fspec impl supports keyword lookup of its :args, :ret, and :fn specs
>> - fix fspec describe which was missing keys and improve describe of 
>> :args/ret/fn specs
>> - instrument now checks *only* the :args spec of a var - use the 
>> clojure.spec.test functions to test :ret and :fn specs
>> - Added generator support for bytes? and uri? which were accidentally 
>> left out in alpha5
>>
>> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com 
> Note that posts from new members are moderated - please be patient with 
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com 
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/JIgmEFhAlq8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> clojure+u...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Clojure 1.9.0-alpha6

2016-06-15 Thread Sean Corfield
Hopefully you can also provide an answer around my question (in that thread) 
about losing the “nice” exceptions and instead getting “just” a data structure 
from things like check-var?

 

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


 

On 6/15/16, 4:37 PM, "Alex Miller"  wrote:

 

Check out the thread at 
https://groups.google.com/forum/m/#!topic/clojure/RLQBFJ0vGG4


On Jun 15, 2016, at 5:22 PM, adrian.med...@mail.yu.edu wrote:

I was wondering if you could shed some light on why instrument was changed to 
not automatically check the :ret and :fn specs. 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, 2016 at 1:31:25 PM UTC-4, Alex Miller wrote:

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 do not

- returns from alt/or are now map entries (supporting key/val) rather than 
2-element vector

- [BREAKING] fn-specs was renamed to fn-spec and returns either the registered 
fspec or nil

- fspec now accepts ifn?, not fn?

- fspec impl supports keyword lookup of its :args, :ret, and :fn specs

- fix fspec describe which was missing keys and improve describe of 
:args/ret/fn specs

- instrument now checks *only* the :args spec of a var - use the 
clojure.spec.test functions to test :ret and :fn specs

- Added generator support for bytes? and uri? which were accidentally left out 
in alpha5

 

 

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Clojure 1.9.0-alpha6

2016-06-15 Thread Alex Miller
Check out the thread at 
https://groups.google.com/forum/m/#!topic/clojure/RLQBFJ0vGG4

> On Jun 15, 2016, at 5:22 PM, adrian.med...@mail.yu.edu wrote:
> 
> I was wondering if you could shed some light on why instrument was changed to 
> not automatically check the :ret and :fn specs. 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, 2016 at 1:31:25 PM UTC-4, Alex Miller wrote:
>> 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 do not
>> - returns from alt/or are now map entries (supporting key/val) rather than 
>> 2-element vector
>> - [BREAKING] fn-specs was renamed to fn-spec and returns either the 
>> registered fspec or nil
>> - fspec now accepts ifn?, not fn?
>> - fspec impl supports keyword lookup of its :args, :ret, and :fn specs
>> - fix fspec describe which was missing keys and improve describe of 
>> :args/ret/fn specs
>> - instrument now checks *only* the :args spec of a var - use the 
>> clojure.spec.test functions to test :ret and :fn specs
>> - Added generator support for bytes? and uri? which were accidentally left 
>> out in alpha5
> 
> -- 
> 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 patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/JIgmEFhAlq8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Clojure 1.9.0-alpha6

2016-06-15 Thread adrian . medina
I was wondering if you could shed some light on why instrument was changed 
to not automatically check the :ret and :fn specs. 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, 2016 at 1:31:25 PM UTC-4, Alex Miller wrote:
>
> 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 do not
> - returns from alt/or are now map entries (supporting key/val) rather than 
> 2-element vector
> - [BREAKING] fn-specs was renamed to fn-spec and returns either the 
> registered fspec or nil
> - fspec now accepts ifn?, not fn?
> - fspec impl supports keyword lookup of its :args, :ret, and :fn specs
> - fix fspec describe which was missing keys and improve describe of 
> :args/ret/fn specs
> - instrument now checks *only* the :args spec of a var - use the 
> clojure.spec.test functions to test :ret and :fn specs
> - Added generator support for bytes? and uri? which were accidentally left 
> out in alpha5
>
>

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ANN metrics-clojure 2.7.0 is released

2016-06-15 Thread Michael Klishin
metrics-clojure [1] is a Clojure interface to the Metrics library [2],
originally by Steve Losh [3].

Release notes:
http://blog.clojurewerkz.org/blog/2016/06/02/metrics-clojure-2-dot-7-0-is-released/

If you're new to metrics and not sure why collecting them is a good idea,
take a moment to watch [4].

1. https://github.com/sjl/metrics-clojure
2. http://metrics.codahale.com/
3. http://stevelosh.com/
4. http://www.youtube.com/watch?v=czes-oa0yik
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ANN Ogre 3.0.0.0-beta1 and future plans for Ogre

2016-06-15 Thread Michael Klishin
Ogre [1] is a Clojure dialect of Gremlin, a DSL for querying and otherwise
working with Apache TinkerPop [2] graphs.

Over the last 6 months or so Ogre maintainers have moved it to target
TinkerPop 3.x.
Since TinkerPop itself has changed quite a bit and is now an Apache
incubator project,
Ogre API had to change a few times.

We are happy to announce that the first milestone release is up on
Clojars: 3.0.0.0-beta1.
If you are interested in working with TinkerPop from Clojure, please
give Ogre a try and
let us know how it goes. Since the API is not entirely set in stone
yet on either TinkerPop
or Ogre end, it may change without a notice. For the same reason we
don't have documentation
guides updated. We aim to keep this new version of Ogre compatible
with TinkerPop 3.x as it
evolves and documented well when the API is stable enough.

I'd like to thank Stephen  Mallette and Andrew Fitzgerald for doing
99% of the work in this release.

In case you have a specific suggestion or run into a bug or a
usability problem, please
file an issue on GitHub [1].

1. https://github.com/clojurewerkz/ogre
2. http://tinkerpop.apache.org/
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reagent template routing

2016-06-15 Thread Joakim Mohn
The reagent template uses compojure server sider routing and 
secretary/accountant on the client (cljs).

https://github.com/reagent-project/reagent-template/blob/master/resources/leiningen/new/reagent/src/clj/reagent/handler.clj

As you can see on line 38 the the server routes correspond to the client 
side routes. I'm not used to seeing web apps like this. Usually I just use 
server for json output. What are the advantages/disadvantages to this 
approach? I'm gonna build a CRUD app with clj backend and cljs front end. 
My first project in clojure.

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.spec regression bug for 1.9.0-alpha6

2016-06-15 Thread Sean Corfield
Given that we now have to use clojure.spec.test to get :ret / :fn tested, we 
lose the “nice” exceptions explaining the conformance failure:

 

Alpha 5:

 

;;=> ExceptionInfo Call to #'spec-example.core/ranged-rand did not conform to 
spec:

;;=> At: [:fn] val: {:args {:start 8, :end 10}, :ret 7} fails predicate: (>= 
(:ret %) (-> % :args :start))

;;=> :clojure.spec/args  (8 10)

;;=>   clojure.core/ex-info (core.clj:4617)

 

Alpha 6:

 

boot.user=> (t/check-var #'ranged-rand)

{:result {:clojure.spec/problems {[] {:pred (>= (:ret %) (-> % :args :start)), 
:val {:args {:start -1, :end 2}, :ret -2}, :via [], :in []}}, :failed-on :fn}, 
:seed 1466016600676, :failing-size 4, :num-tests 5, :fail [(-1 2)], :shrunk 
{:total-nodes-visited 5, :depth 1, :result {:clojure.spec/problems {[] {:pred 
(>= (:ret %) (-> % :args :start)), :val {:args {:start -1, :end 1}, :ret -2}, 
:via [], :in []}}, :failed-on :fn}, :smallest [(-1 1)]}}

 

Are there plans to provide an “explain” equivalent for this?

 

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


 

On 6/15/16, 11:33 AM, "Alex Miller"  wrote:

 

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 < end"

  [start end]

  (+ start (rand-int (- start end

 

(s/fdef ranged-rand

  :args (s/and (s/cat :start integer? :end integer?)

   #(< (:start %) (:end %)))

  :ret integer?

  :fn (s/and #(>= (:ret %) (-> % :args :start))

 #(< (:ret %) (-> % :args :end

(ranged-rand 8 10)

;;=> ExceptionInfo Call to #'spec-example.core/ranged-rand did not conform to 
spec:

;;=> At: [:fn] val: {:args {:start 8, :end 10}, :ret 7} fails predicate: (>= 
(:ret %) (-> % :args :start))

;;=> :clojure.spec/args  (8 10)

;;=>   clojure.core/ex-info (core.clj:4617)

(println *clojure-version*)

;;=> {:major 1, :minor 9, :incremental 0, :qualifier alpha1}

 

(s/instrument #'ranged-rand)

(ranged-rand 8 10)

;;=> 7

(println *clojure-version*)

;;=> {:major 1, :minor 9, :incremental 0, :qualifier alpha6}

```

 

user=> (require '[clojure.spec :as s])
user=> (defn dummy [x] (if x "yes" "no"))
user=> (s/fdef dummy
  #_=>   :args (s/cat :x integer?)
  #_=>   :ret  integer?)
user=> (s/instrument #'dummy)
user=> (dummy 3) (println *clojure-version*)
ExceptionInfo Call to #'user/dummy did not conform to spec:
val: "yes" fails at: [:ret] predicate: integer?
:clojure.spec/args  (3)
  clojure.core/ex-info (core.clj:4703)
{:major 1, :minor 9, :incremental 0, :qualifier alpha5}

;---

user=> (dummy 3) (println *clojure-version*)
"yes"
{:major 1, :minor 9, :incremental 0, :qualifier alpha6}

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[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? => int?  - now checks for all Java fixed precision integer types 
(byte,short,integer,long)
- pos-long? => pos-int?
- neg-long? => neg-int?
- nat-long? => nat-int?

clojure.spec:
- long-in-range? => int-in-range?
- long-in => int-in

If you are interested in checking specifically for long?, please use 
#(instance? Long %).

Sorry for the switcheroo and welcome to alphatown! 

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 these specs does not flow conformed values (because 
> they are not all conformed).*
>
>
This is really referring to something like this:

(s/explain (s/map-of keyword? string?) (zipmap (range 10) (range 10))
val: {0 0, 7 7, 1 1, 4 4, 6 6, 3 3, 2 2, 9 9, 5 5, 8 8} fails predicate: 
(coll-checker (tuple keyword? string?))

The spec fails but does not indicate more precisely the tuple where the 
error failed.

 

> From playing around a bit and reading the sources I came to the conclusion 
> that the above means that values are indeed returned by conform but those 
> values (specifically, from the sources, after the first 100 values) do 
> not necessarily conform to the predicates, is that the correct way to read 
> the above?
>

But also, yes that is how the predicates are checked.
 

> Are there any plans of implementing a more statistical approach in the 
> future in order to increase the chance of finding bugs?
>

No.
 

>
> Is it a bad idea to bind *coll-check-limit* to infinity in a local thread 
> binding for more thorough possibly time and CPU consuming testing of a 
> specific function?
>

That's up to you. Because this has come up a number of times, Rich may add 
some variant for this kind of thing 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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-15 Thread Oded Badt
>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 these specs does not flow conformed values (because 
they are not all conformed).*

>From playing around a bit and reading the sources I came to the conclusion 
that the above means that values are indeed returned by conform but those 
values (specifically, from the sources, after the first 100 values) do 
not necessarily conform to the predicates, is that the correct way to read 
the above?
Are there any plans of implementing a more statistical approach in the 
future in order to increase the chance of finding bugs?
Is it a bad idea to bind *coll-check-limit* to infinity in a local thread 
binding for more thorough possibly time and CPU consuming testing of a 
specific function?

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 < end"
>   [start end]
>   (+ start (rand-int (- start end
>
> (s/fdef ranged-rand
>   :args (s/and (s/cat :start integer? :end integer?)
>#(< (:start %) (:end %)))
>   :ret integer?
>   :fn (s/and #(>= (:ret %) (-> % :args :start))
>  #(< (:ret %) (-> % :args :end
> (ranged-rand 8 10)
> ;;=> ExceptionInfo Call to #'spec-example.core/ranged-rand did not conform 
> to spec:
> ;;=> At: [:fn] val: {:args {:start 8, :end 10}, :ret 7} fails predicate: 
> (>= (:ret %) (-> % :args :start))
> ;;=> :clojure.spec/args  (8 10)
> ;;=>   clojure.core/ex-info (core.clj:4617)
> (println *clojure-version*)
> ;;=> {:major 1, :minor 9, :incremental 0, :qualifier alpha1}
>
> (s/instrument #'ranged-rand)
> (ranged-rand 8 10)
> ;;=> 7
> (println *clojure-version*)
> ;;=> {:major 1, :minor 9, :incremental 0, :qualifier alpha6}
> ```
>  
>
>> user=> (require '[clojure.spec :as s])
>> user=> (defn dummy [x] (if x "yes" "no"))
>> user=> (s/fdef dummy
>>   #_=>   :args (s/cat :x integer?)
>>   #_=>   :ret  integer?)
>> user=> (s/instrument #'dummy)
>> user=> (dummy 3) (println *clojure-version*)
>> ExceptionInfo Call to #'user/dummy did not conform to spec:
>> val: "yes" fails at: [:ret] predicate: integer?
>> :clojure.spec/args  (3)
>>   clojure.core/ex-info (core.clj:4703)
>> {:major 1, :minor 9, :incremental 0, :qualifier alpha5}
>>
>> ;---
>>
>> user=> (dummy 3) (println *clojure-version*)
>> "yes"
>> {:major 1, :minor 9, :incremental 0, :qualifier alpha6}
>>
>

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.spec regression bug for 1.9.0-alpha6

2016-06-15 Thread webber
Maybe, the following is the same reason.

```
(defn ranged-rand   ;; BROKEN!
  "Returns random integer in range start <= rand < end"
  [start end]
  (+ start (rand-int (- start end

(s/fdef ranged-rand
  :args (s/and (s/cat :start integer? :end integer?)
   #(< (:start %) (:end %)))
  :ret integer?
  :fn (s/and #(>= (:ret %) (-> % :args :start))
 #(< (:ret %) (-> % :args :end
(ranged-rand 8 10)
;;=> ExceptionInfo Call to #'spec-example.core/ranged-rand did not conform 
to spec:
;;=> At: [:fn] val: {:args {:start 8, :end 10}, :ret 7} fails predicate: 
(>= (:ret %) (-> % :args :start))
;;=> :clojure.spec/args  (8 10)
;;=>   clojure.core/ex-info (core.clj:4617)
(println *clojure-version*)
;;=> {:major 1, :minor 9, :incremental 0, :qualifier alpha1}

(s/instrument #'ranged-rand)
(ranged-rand 8 10)
;;=> 7
(println *clojure-version*)
;;=> {:major 1, :minor 9, :incremental 0, :qualifier alpha6}
```
 

> user=> (require '[clojure.spec :as s])
> user=> (defn dummy [x] (if x "yes" "no"))
> user=> (s/fdef dummy
>   #_=>   :args (s/cat :x integer?)
>   #_=>   :ret  integer?)
> user=> (s/instrument #'dummy)
> user=> (dummy 3) (println *clojure-version*)
> ExceptionInfo Call to #'user/dummy did not conform to spec:
> val: "yes" fails at: [:ret] predicate: integer?
> :clojure.spec/args  (3)
>   clojure.core/ex-info (core.clj:4703)
> {:major 1, :minor 9, :incremental 0, :qualifier alpha5}
>
> ;---
>
> user=> (dummy 3) (println *clojure-version*)
> "yes"
> {:major 1, :minor 9, :incremental 0, :qualifier alpha6}
>

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Exercises and projects for my on-site training course

2016-06-15 Thread Daniel Higginbotham
Hi all,

I've begun offering on-site Clojure training 
 (loving it so far!) and wanted to 
share the examples, exercises, and projects 
 that we work through. I've tried 
to include plenty of comments and documentation throughout so that the 
resource is useful for self-study as well.

If you're interested in scheduling a training session, please let me know 
:) I have one session (3-5 days) available for July/August.

Thanks!
Daniel

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: why is it so annoying to run clojure code

2016-06-15 Thread Kenneth Tilton
On Wed, Jun 15, 2016 at 10:54 AM, James Gatannah 
wrote:

> It was (thoughtfully and politely) pointed out that I came across as smug
> here.
>
> I'm very sorry about that. I plead exhaustion.
>

Heh-heh, well, as the late, great Erik Naggum once said to me, you meant
well and that is all that matters.

Also, we are in complete agreement on the advantages of lein/boot/whatever
so I did not know what to say.

Me, I am a lousy typist so I never use a repl. I also normally program
Common Lisp in the AllegroCL IDE which is so awesome I use it even though
it runs only on Windows .

My observation about not being able (in effect) to just type "clojure" at
the shell command line and get a prompt was more about "Gosh, there sure is
a lot of tooling involved in programming Clojure".

I am reminded of cars. Back in the day anyone with the gumption could work
on a car. I recall coming out of week-long retreat with a group of fellow
grad students and one of them discovering her brake pedal went to the
floor. I grabbed the tools from the toolbox in my trunk and in like five
minutes we bled her brake line. Nowadays? Fuggedabout it. Hell, the
mechanic at my corner garage refuses to do anything more than tires and
batteries.

OTOH, as you say, now that I have lein somewhat under control I am working
about as efficiently as I did with AllegroCL, so the learning curve pays
off. I may even jump into boot and arrange it for it to kick off qooxdoo
builds along with my cljs builds (necessary only for releases).

cheers, kenneth

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: why is it so annoying to run clojure code

2016-06-15 Thread James Gatannah
It was (thoughtfully and politely) pointed out that I came across as smug 
here.

I'm very sorry about that. I plead exhaustion.

I use python for most of my day job. I was trying to convey how much more
painful its workflow is for me, now that I've embraced "the lisp way" for my
personal projects (I have a toddler...I don't have time to spend on all the 
things that most of the computer industry never even questions).

I meant to go back and edit this to replace "you" with examples of how *I* 
do
these things wrong. I hit Send instead of saving to a draft until this 
morning.

There is a learning curve, and it's a serious change in your point of view. 
But it
really is totally worth it.

Respectfully and apologetically,
James

On Wednesday, June 15, 2016 at 1:02:55 AM UTC-5, James Gatannah wrote:
>
> I *totally* understand your (and pretty much every other responder's) 
> frustration.
>
> You're approaching it wrong.
>
> Most python/ruby programmers get this wrong, also. It's OK. I did this 
> wrong for
> *years* in lots of different languages. (I blame my C++ background for how 
> long
> it's taking this to sink in for me).
>
> One of the keys to "getting" lisp is to embrace the REPL. Start your 
> environment
> up. And let it run. It isn't a living, breathing entity, but it's easy to 
> forget that after
> a short while.
>
> Python's interactive shell covers the same idea. I think ruby has IRB to 
> do the
> same sort of thing. But those are just kind-a sort-a "See? We can do the 
> same
> thing lisp does" wannabes.
>
> I don't want to trash talk ruby or python. They're both great languages 
> for what
> they do.
>
> But they're designed for solving different, easier problems. And they're 
> built for
> coping with those problems in ways that are horribly more complicated.
>
> I came to clojure from a python/common lisp background (and I came to them
> from a C++ background). I spent years hating everything different about 
> it, 
> and I was totally wrong.
>
> Long startup time? Totally worth it. I go through it a few times when I 
> get my
> basic system defined. (People have already recommended Stuart Sierra's
> Component architecture in this thread, haven't they?)
>
> And then my entire system is defined and works. I don't ever need to 
> restart
> until I bring in a new dependency.
>
> When I work in python, I have to restart everything under the sun every 
> time
> I screw up the arguments to a printf.
>
> Immutable data structures? This is the paydirt, darling. I thought that 
> this was
> the most horrible part of clojure, and I wasted reams of imagination 
> trying to
> figure out ways around it.
>
> And I was wrong.
>
> Unless you're writing an OS kernel, you should probably be using immutable
> data structures. Even if you're genius enough to track all the ways that 
> your
> mutable data structure could possibly be mangled, the next person to come
> along and deal with it won't be as smart as you.
>
> That "next person" is usually you 6 months in the future. Don't screw 
> yourself
> over.
>
> And then there's the JVM.
>
> I used to think I was safer from hackers because the JVM gets hacked
> 20,000 times a day and "my" platform *never* got hacked.
>
> Then someone pointed out that the JVM gets attacked 20 bazillion times a
> second, whereas "my" platform would never get attacked until/unless I
> actually created something successful on it.
>
> Just learn how to use lein and/or boot. It *is* annoying, but a good
> investment.
>
>
> On Thursday, June 9, 2016 at 11:08:39 AM UTC-5, Jiacai Liu wrote:
>>
>> I  started learning clojure recently, and I am annoyed at the way to run 
>> it (aka. lein run). why clojure script can't be run like python,ruby or 
>> scala, like python .py
>>
>

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-15 Thread Walter van der Laan
You can wrap s/keys in s/and to add additional predicates, eg;

(s/and (s/keys) #(or (::secret %) (and (::user %) (::pwd %

You can also match the map with a predicate instead of s/keys, eg;

#(and (map? %) (or (::secret %) (and (::user %) (::pwd %

The the first option, with s/keys, will check the map for matching 
registry-keys while the second option will not.

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 them. Instead 
I picked the most likely uri form people expect to see. 

Similarly, building a growing, widely random set of urls that still match the 
spec is itself a fun project. I saw no point in building that though if, again, 
people will need to override it anyways.

If you want to build a really amazing shrinking uri generator, I would 
recommend doing so in test.check so that we can use it from core.

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-15 Thread Den Semenenko
Can`t grok how to deffine exclusive groups of :req keys with spec/keys. 

For а doc sample (s/keys :req [(or ::secret (and ::user ::pwd))]) I 
expected, that valid combination is a ::secret *either* ::user and ::pwd. 
But a map with all of these keys is still valid...

Any tips how to spec a plain map with either ::secret either ::user and 
::pwd? 

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: why is it so annoying to run clojure code

2016-06-15 Thread James Gatannah
I *totally* understand your (and pretty much every other responder's) 
frustration.

You're approaching it wrong.

Most python/ruby programmers get this wrong, also. It's OK. I did this 
wrong for
*years* in lots of different languages. (I blame my C++ background for how 
long
it's taking this to sink in for me).

One of the keys to "getting" lisp is to embrace the REPL. Start your 
environment
up. And let it run. It isn't a living, breathing entity, but it's easy to 
forget that after
a short while.

Python's interactive shell covers the same idea. I think ruby has IRB to do 
the
same sort of thing. But those are just kind-a sort-a "See? We can do the 
same
thing lisp does" wannabes.

I don't want to trash talk ruby or python. They're both great languages for 
what
they do.

But they're designed for solving different, easier problems. And they're 
built for
coping with those problems in ways that are horribly more complicated.

I came to clojure from a python/common lisp background (and I came to them
from a C++ background). I spent years hating everything different about it, 
and I was totally wrong.

Long startup time? Totally worth it. I go through it a few times when I get 
my
basic system defined. (People have already recommended Stuart Sierra's
Component architecture in this thread, haven't they?)

And then my entire system is defined and works. I don't ever need to restart
until I bring in a new dependency.

When I work in python, I have to restart everything under the sun every time
I screw up the arguments to a printf.

Immutable data structures? This is the paydirt, darling. I thought that 
this was
the most horrible part of clojure, and I wasted reams of imagination trying 
to
figure out ways around it.

And I was wrong.

Unless you're writing an OS kernel, you should probably be using immutable
data structures. Even if you're genius enough to track all the ways that 
your
mutable data structure could possibly be mangled, the next person to come
along and deal with it won't be as smart as you.

That "next person" is usually you 6 months in the future. Don't screw 
yourself
over.

And then there's the JVM.

I used to think I was safer from hackers because the JVM gets hacked
20,000 times a day and "my" platform *never* got hacked.

Then someone pointed out that the JVM gets attacked 20 bazillion times a
second, whereas "my" platform would never get attacked until/unless I
actually created something successful on it.

Just learn how to use lein and/or boot. It *is* annoying, but a good
investment.


On Thursday, June 9, 2016 at 11:08:39 AM UTC-5, Jiacai Liu wrote:
>
> I  started learning clojure recently, and I am annoyed at the way to run 
> it (aka. lein run). why clojure script can't be run like python,ruby or 
> scala, like python .py
>

-- 
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 patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.