Re: Why does the `def-` not exist?

2018-03-02 Thread Léo Noel
My opinionated 2 cents : I think the whole visibility feature was a 
mistake, it doesn't provide any value and it should be taken away from the 
compiler (I guess it would not break anything to ignore :private metadata 
and make every var public).

Every single time I asked myself whether I needed a var to be private, I 
ended up to the conclusion that I did not need this feature.

The most common scenario is when the value is an implementation detail. In 
this case there's generally good reasons to allow other namespaces to use 
it : you may want to test it in isolation, you may want to tinker with the 
implementation from another place. Your requirement is purely social, what 
you actually need is a way to tell your users "use this at your own risk, 
it expects sanitized input, it can break in future versions" and there's a 
bunch of ways to do it, as many already said : move it in a separate 
namespace, do not document it, use a naming convention (a prefix "-" or a 
suffix "*" are pretty common). Your users are not children : inform, don't 
forbid. If you ignore warnings, you deserve production bugs.

Now for the very exceptional case where you're positively sure a value 
won't make any sense outside of a restricted scope, clojure has this useful 
feature called lexical scoping :

(ns my.public.api)

(let [private (here be dragons)]
  (defn do-stuff [args]
(stuff private args))
  (defn do-things [args]
(things private args)))

Visibility enforced by the compiler. Guaranteed. Your IDE won't even 
suggest it.


On Thursday, March 1, 2018 at 12:35:27 PM UTC+1, Leon Grapenthin wrote:
>
> I guess unqualified meta keywords are reserved for the compiler anyway so 
> it could just warn if it doesn't know a unqualified kw.

-- 
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: Loop causing OutOfMemoryError: GC overhead limit exceeded ?

2018-03-02 Thread Rob Nikander


On Friday, March 2, 2018 at 12:48:28 AM UTC-5, Daniel wrote:
>
> How do you know this code is causing the error? Unless this is all your 
> code does, descriptions of the error suggest the memory leak might be 
> coming from anywhere. This tight loop might trigger too many successive GCs 
> though: have you observed if the error only occurs under load, or under 
> large time intervals? Some combination?
>

Okay, thanks for looking it over. This is a single-threaded, short lived 
script, so this is the only thing happening. But it's possible there is an 
unexpected large result set. I'll look into that. It may be smarter to use 
`limit N` in my SQL, rather than the time range.

>

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


Using an initialization file with leiningen

2018-03-02 Thread Doug Telford
When initiating clojure with clj, you can specify an initialization file.  
However, if I run lein repl, it is not clear how to specify an 
initialization file.  I looked at the documunt for :repl-init but didn't 
see anything applicable.

-- 
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: Loop causing OutOfMemoryError: GC overhead limit exceeded ?

2018-03-02 Thread Gary Johnson
As Daniel pointed out, this could probably be done more idiomatically (and 
functionally) using sequence functions. Here is a quick shot at a rewrite 
without any atoms or mutable state in the same number of lines of code (18) 
as your original example. If some of the intermediate lazy sequences cause 
any noticeable performance slow-down, you could switch over to transducers 
pretty easily.

(defn find-db-records-seq [db min-time max-time]
  (->> min-time
   (iterate #(plus-minutes % 30))
   (take-while #(before? % max-time))
   (partition 2 1 [max-time])
   (reduce (fn [{:keys [num-processed records]} [min-t max-t]]
 (let [results (jdbc/query db
   ["select id, a, b, c from 
sometable where t > ? and t <= ? order by t"
min-t max-t])]
   {:num-processed (+ num-processed (count results))
:records (into records
   (mapcat (fn [rows]
 (let [foo (make-foo rows)]
   (->> rows
(filter (fn [{:keys [a b
]}] (relevant-record? foo a b)))
(map (fn [{:keys [id a 
b c]}] {:id id :a a :d (compute-d a b c)})
   (partition-all 200 results)))}))
   {:num-processed 0 :records []})))


Happy hacking!
  Gary

-- 
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: Using an initialization file with leiningen

2018-03-02 Thread Doug Telford
correction:  :repl:init should have been :repl-options

On Friday, March 2, 2018 at 11:01:01 AM UTC-7, Doug Telford wrote:
>
> When initiating clojure with clj, you can specify an initialization file.  
> However, if I run lein repl, it is not clear how to specify an 
> initialization file.  I looked at the documunt for :repl-init but didn't 
> see anything applicable.
>

-- 
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] com.walmartlabs/lacinia 0.25.0, com.walmartlabs/lacinia-pedestal 0.7.0

2018-03-02 Thread Howard Lewis Ship
Lacinia is an open-source implementation of Facebook's GraphQL
specification, in Clojure.

GraphQL is an outstanding approach to getting diverse clients and servers
exchanging data cleanly and efficiently.

GitHub repo:  https://github.com/walmartlabs/lacinia

Documentation: http://lacinia.readthedocs.io/en/latest/

Featured changes in 0.25.0:

- fields and operations may now be marked deprecated
- enums field resolvers may return a string or symbol, not just a keyword

lacinia-pedestal provides the Pedestal support to expose web endpoints
backed by Lacinia's GraphQL.

GitHub repo: https://github.com/walmartlabs/lacinia-pedestal

Documentation: http://lacinia-pedestal.readthedocs.io/en/latest/

Featured changes in 0.7.0:

- improvements to subscription pipeline
- New function to manipulate a list of interceptors (replacing the
interceptors namespace)

-- 
Howard M. Lewis Ship

Senior Mobile Developer at Walmart Labs

Creator of Apache Tapestry

(971) 678-5210
http://howardlewisship.com
@hlship

-- 
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] org.clojure/core.cache & org.clojure/core.memoize 0.7.1 released!

2018-03-02 Thread Sean Corfield
As the new maintainer of these two Contrib libraries, I am happy to announce 
their joint 0.7.1 releases!

https://github.com/clojure/core.cache -- a caching protocol and several 
implementation strategies
https://github.com/clojure/core.memoize -- a function memoization protocol and 
several implementation strategies based on core.cache

core.cache changes:

  *   Release 0.7.1 on 2018.03.02

  *   CCACHE-49 Fix TTLCacheQ seed function and expand tests on TTLCacheQ

  *   Release 0.7.0 on 2018.03.01

  *   CCACHE-46 Fix TTLCache when wrapped around another cache (Ivan 
Kryvoruchko)
  *   CCACHE-43 Add through-cache to provide a version of through that plays 
nice with swap! etc
  *   CCACHE-40 Fix FIFOCache stack overflow on large threshold (uses 
PersistentQueue now instead of concat and list)
  *   CCACHE-39 Fix FIFOCache evict/miss queue handling
  *   CCACHE-20 Updated README to clarify that caches are immutable and provide 
examples of use with atom etc
  *   CCACHE-15 Added queue and generation logic to reduce miss cost and make 
evict O(1); rename TTLCache -> TTLCacheQ (Kevin Downey)
  *   Drop support for Clojure 1.3/1.4/1.5

core.memoize changes:

  *   Release 0.7.1 on 2018.03.02
 *   Fixes CMEMOIZE-15 - edge case where cache miss/lookup cross an 
eviction boundary (Ryan Fowler/Colin Jones)
 *   Updated core.cache dependency version from 0.7.0 to 0.7.1 (for 
TTLCacheQ bug fix)
  *   Release 0.7.0 on 2018.03.01
 *   Fixes CMEMOIZE-22 - add :clojure.core.memoize/args-fn metadata support 
for memoizing functions which have one or more arguments that should not 
contribute to the cache key for calls
 *   Fixes CMEMOIZE-20 - add lazy-snapshot function
 *   Fixes CMEMOIZE-18 - automatically makes seed map values deref-able to 
match documentation and comply with core.memoize's world view
 *   Cleanup/improve/fix tests
 *   Add multi-version testing locally via Leiningen
 *   Jump to 0.7.0 to match core.cache since these two libraries are so 
closely in sync
 *   Drop support for Clojure 1.3/1.4/1.5

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

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

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


Any better client then telnet for connecting to a socket repl server?

2018-03-02 Thread Didier
I want to connect to a Clojure socket repl server, but telnet is a really 
terrible repl experience. Anyway I can have a better client to connect to 
it that would have some better support for history, backspace, maybe even 
some auto-complete, highlight, etc. Whatever I can get over telnet?

Thanks

-- 
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 does the `def-` not exist?

2018-03-02 Thread Daniel
"University me" is yelling incredulously in my ear for saying this, but ... I 
have no use for private vars and private functions anymore. When that voice 
persuades me to evaluate a namespace for visibility I always feel like I'm 
over-engineering.

-- 
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 does the `def-` not exist?

2018-03-02 Thread Daniel
I'm not advocating for it's removal though. That would be silly.

-- 
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] org.clojure/core.cache & org.clojure/core.memoize 0.7.1 released!

2018-03-02 Thread Didier
Awesome, thanks for taking the lead and maintaining some of these awesome libs. 

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