Re: Is it wrong that I'm thinking about this?

2017-09-22 Thread Didier
> The goal is to add the macro to orchestra, as a tool to help encourage 
> spec'ing all functions.

That would be great. My macro for now was also not supporting all defn cases 
yet. And it automatically instruments the fn with orchestra. So if orchestra 
had a more complete one defacto, I wouldn't need one.

For performance, I've been thinking that caching validation (with some 
configurable cache bounds), or having sample based validation, so validating 
only a percentage of calls, and maybe even having the sampling rate controlled 
by execution time metrics, or cpu metrics or call rates, etc. would be 
interesting possibilities. So in prod, you could tweek the validation to only 
get as much of it as you can afford.

-- 
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] Instaparse 1.4.8

2017-09-22 Thread Mark Engelberg
Instaparse 1.4.8 has been updated to support a breaking change that was
made in Clojurescript 1.9.854, relating to the reader.  The change has been
tested with Clojurescript versions 1.7.28 and up.

No functionality changes, and this update should not matter for Clojure
users.
Instaparse supports Clojure 1.5.1 and up.

Thanks to pkpkpk for providing the pull request with the necessary fix:
https://github.com/Engelberg/instaparse/pull/169

(Please note that Clojurescript does not currently work with Clojure
1.9-alpha20 or newer: https://dev.clojure.org/jira/browse/CLJS-2352)

--Mark

-- 
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: Is it wrong that I'm thinking about this?

2017-09-22 Thread Jeaye
I think you're on the right track, personally. We've had a macro similar to 
that which we've been using for a handful of months. Just this week, I rewrote 
it using the defn specs from clojure.specs.alpha to support all of the forms 
which defn supports, including multiple arities with different specs for each. 
The goal is to add the macro to orchestra, as a tool to help encourage spec'ing 
all functions.

A lot of people are separating their specs from their functions and can make 
some arguments for why it should be done. For my team, in practice, it's been 
much easier to keep them as close as possible to their functions. This helps 
minimize time spent maintaining them, ensures that they don't fall out of date, 
and encourages their use, as you've demonstrated, by inlining them into the 
typical defn-like environment.

On Tue, Sep 19, 2017 at 02:29:33PM -0700, Didier wrote:
> I've been thinking since using Clojure.spec fdef that I'd like something 
> like this:
> 
> (defns foo
>   [x string? y int?] string?
>forms)
> 
> Where an s/fdef spec automatically build of this form:
> 
> (s/fdef foo
>   :args (s/cat :x string? :y int?)
>   :ret string?))
> 
> 
> And obviously the foo var and function would also be created.
> 
> I feel like the core team didn't choose this route though, and so I'm 
> curious why, and if its actually a bad idea?
> 
> -- 
> 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.


signature.asc
Description: PGP signature


Re: Java 9 module system quirks

2017-09-22 Thread Piyush Katariya
Awesome. Thanks

On 22-Sep-2017 21:23, "Alex Miller"  wrote:

> For a rundown, see:
> https://groups.google.com/d/msg/clojure/IB2CaORBMnM/oKvk6cLuDAAJ
>
> Since then CLJ-2077 has been applied and is available in Clojure
> 1.9.0-beta1.
>
> I expect all important issues to be resolved by GA release of Clojure 1.9.
>
> On Friday, September 22, 2017 at 8:16:13 AM UTC-5, Piyush Katariya wrote:
>>
>> Java 1.9 has been released with module system feature
>>
>> Does Clojure v1.9 before going GA solve the issues mentioned in this talk
>> or will it be possible in next version Clojure only ?
>>
>> https://www.youtube.com/watch?v=4fevIDAxQAM
>>
>> --
> 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/fTkpfi7r6f8/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: When does .getThreadCpuTime return nil?

2017-09-22 Thread Neil Okamoto

Maybe it's because you attempted method invocation via reflection but the 
object is nil. So for example if (threads) returns a list containing nils, 
then calling (.getId t) or (.getName t) would probably throw a null pointer 
exception. I'm not sure it's possible for 
(ManagementFactory/getThreadMXBean) to return nil, but if it does then 
(.getThreadCpuTime mgr ...) would similarly fail.

So best guess is, take a look at the implementation of "threads".




On Friday, September 22, 2017 at 1:37:04 PM UTC-7, lawrence...@gmail.com 
wrote:
>
> I've been using this code for years. I copy and pasted it from someone 
> else on this group, someone much smarter than I am. I have never seen an 
> error from this code. Now suddenly I get a null pointer exception at the 
> last line of this code: 
>
> (ns denormalize_mysql_to_mongodb.monitoring
>   (:import
>java.lang.management.ManagementFactory)
>   (:require [clojure.string :as st]))
>
>
> (defn thread-top
>   "Return a seq of threads sorted by their total userland CPU usage."
>   []
>   (let [mgr (ManagementFactory/getThreadMXBean)
> cpu-times (map (fn [t]
>  [(.getThreadCpuTime mgr (.getId t)) t])
> (threads))]
> (map
>   (fn [[cpu t]] [cpu (.getName t) (.getId t) t])
>   (reverse (sort-by first cpu-times)
>
> This error is thrown at startup. I don't know much about ThreadMXBean. Can 
> anyone give me a clue why any of this would be nil? 
>
>
>
>
>
>

-- 
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: Obtaining the predicate of a spec

2017-09-22 Thread David Bürgin
On 22/09/17 23:19, Beau Fabry wrote:
> 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 %)

Fair, but I was thinking specifically of those situations where you want
to bypass the spec registry, say where you really need the performance
of the predicate, not the spec.

-- 
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: 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 
> introspection feature of spec. See if it returns what you need.

-- 
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.org

2017-09-22 Thread Nathan Fisher
Hi Alex,

Understood, thanks for the quick reply! I recently came across Steve
Yegge's rant on Clojure accessibility to newbies and was reflecting on how
it could be improved. Thought it was a little thing but could be a nice
addition to ease people in and give them a flavour for the language.

Totally understand that a home page is an important space and you don't
want the kitchen sink thrown in peoples faces. :)

Cheers!
Nathan

On Fri, 22 Sep 2017 at 16:57 Alex Miller  wrote:

> It's there at: https://github.com/clojure/clojure-site
>
> We considered this when building the site and decided not to include it on
> the front page, so probably not interested in including it now. I expect
> we'll look at front page updates at some point though and we'll consider it
> again.
>
> Alex
>
>
> On Friday, September 22, 2017 at 10:51:18 AM UTC-5, Nathan Fisher wrote:
>>
>> Hi All,
>>
>> I'm probably dense but I didn't see the source for clojure.org on
>> https://github.com/clojure. It looks like it's served out of S3 based on
>> at the response headers so I'm guessing it's a static site of some sort...
>>
>> While I don't necessarily subscribe to "everyone else is doing it" I was
>> thinking it would be nice to add a sample snippet of "hello world" code on
>> the home page similar to Go and Ruby's site. I'd see it placed just above
>> the "Learn More" section.
>>
>> I wanted to make a PR with a snippet like:
>>
>> (ns cool.clojure
>>   (:gen-class))
>>
>> (defn -main []
>>   (prn "Hello world!"))
>>
>> Underneath it could link to a page "so you've decided to learn Clojure
>> here's how you map common idioms from OO/imperative to Clojure" obviously
>> it'll need something a little snappier.
>>
>> Kind regards,
>> Nathan
>>
> --
> 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.
>
-- 
- sent from my mobile

-- 
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: Java 9 module system quirks

2017-09-22 Thread Alex Miller
For a rundown, see:
https://groups.google.com/d/msg/clojure/IB2CaORBMnM/oKvk6cLuDAAJ

Since then CLJ-2077 has been applied and is available in Clojure 
1.9.0-beta1.

I expect all important issues to be resolved by GA release of Clojure 1.9.

On Friday, September 22, 2017 at 8:16:13 AM UTC-5, Piyush Katariya wrote:
>
> Java 1.9 has been released with module system feature
>
> Does Clojure v1.9 before going GA solve the issues mentioned in this talk 
> or will it be possible in next version Clojure only ?
>
> https://www.youtube.com/watch?v=4fevIDAxQAM
>
>

-- 
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.