Re: callback before evicting element from cache [core.cache]

2016-11-14 Thread juan.facorro
An option would be to wrap any of the implementations in core.cache with 
your own using core.cache/defcache. Every CacheProtocol function would just 
use the underlying cache, except for the evict where you would handle the 
closing of the file descriptor.

On Tuesday, November 15, 2016 at 12:49:28 AM UTC+1, anurag peshne wrote:
>
> Hello,
>
> I'm trying to use core.cache 
> 
>  as 
> a open file cache. I want to close the file descriptor when the cache entry 
> is removed. However, there is no way to pass any callback before an entry 
> is evicted. Is there any other way of accomplishing this?
>
> Thanks,
> Anurag
>

-- 
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: s/valid? vs. s/explain

2016-11-14 Thread James Gatannah
Ticket filed: http://dev.clojure.org/jira/browse/CLJ-2057

Thanks!

On Sun, Nov 13, 2016 at 3:36 PM, Alex Miller  wrote:
> Any case where valid? returns false and explain-data returns nil is a bug.
>
> --
> 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/1gOBPLk5wpg/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.


[ANN] Tracks 0.1.7 has been released.

2016-11-14 Thread Bryan Maass
Hello,

Tracks is an attempt to simplify the excellent destructuring syntax in our 
beloved Clojure(script).

https://github.com/escherize/tracks

It focuses on using (and documenting) the shape of data to destructure. 
Please check out the readme! :)

Cheers,
Bryan

-- 
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] zprint, lein-zprint Pretty print your code and data

2016-11-14 Thread Kim Kinnear
 

I'm pleased to announce the release of *zprint*, a new Clojure(script) 
pretty print library and associated leiningen plugin to apply it to your source 
files.  The zprint library will pretty print the code in your source files 
when driven by* lein-zprint*, as well as pretty print structures (and code) 
when used directly at the repl in Clojure and Clojurescript.  


https://github.com/kkinnear/zprint

https://github.com/kkinnear/lein-zprint


What, really?  Another pretty printer?


Yes, I know.  We've already got clojure.pprint, fipp, puget, cljfmt. There 
is a full discussion of why zprint exists in the readme.  The short story 
is that zprint completely reformats Clojure source, totally ignoring all of 
the line breaks and whitespace inside of a function definition.  It also 
runs as a library at the repl (and in your code) to print structures very 
nicely, and is totally configurable.


In short, zprint and lein-zprint try to do it all, beautifully, out of the 
box. 


I have just now proposed an *unsession* at the upcoming conj.  If you are 
interested, register your interest and maybe we'll have a session!


A quick example of the basics:


Before:


(print (source-fn 'example))

(defn example

  "Do a diff of two maps, and update an existing doc-map with labels

  of everything that is different. Existing is before the update with

  new." [doc-string doc-map existing new] (let [[only-before only-after 
both]

  (d/diff existing new)] (merge-deep doc-map (map-leaves #(zipmap

  [:value :set-by] [% doc-string]) only-after


After:


(zprint-fn example)

(defn example
  "Do a diff of two maps, and update an existing doc-map with labels 

  of everything that is different. Existing is before the update with 

  new." 

  [doc-string doc-map existing new] 

  (let [[only-before only-after both] (d/diff existing new)] 

(merge-deep doc-map 

(map-leaves #(zipmap [:value :set-by] [% doc-string]) 

only-after


A list of features:


* Prints function definitions at the Clojure repl (including clojure.core 
functions)

* Prints s-expressions (EDN structures) at the repl

* Processes Clojure(script) source files through lein-zprint

* Supports Clojure and Clojurescript (self-hosted Clojurescript coming soon)

* Competitive performance formatting code

* Highly configurable, and it will explain to you how it got configured

* Many specific function classifications and knows a lot about Clojure

* Accepts formatting directives in comments in source files (lein-zprint)

* Respects the right margin specification

* Handles comments, will word wrap long ones

* Maximize screen utilization when formatting code

* Sort and order map keys

* Constant pairing (for keyword argument functions)

* Handles cond variants that include :let [...], etc

* Justify paired output (maps, binding forms, cond clauses, etc.) if desired

* Syntax coloring at the repl

* Has a :style feature that includes a :community style


A few highlights:


1. At the repl you can type (czprint-fn ) and if zprint can find 
the source (as it can for the clojure.* functions and anything defined in 
your source files), you get the function pretty printed in the repl.  With 
colors (which you can change, of course).  Kind of like (doc ...), but you 
get to see the function too.  This is the best way to see what zprint will 
do for your functions.


2. When you use lein-zprint to format your source files, you can put a 
comment in the file ;!zprint {}, where the options can apply only 
to the next defn in the file.  Generally this isn't needed, but sometimes 
you just want to turn off formatting or have it configured a particular way 
for just this one function. I used this maybe three time in all of the 
zprint source, but for those times, it made a big difference in the 
readability.


3. Something I call "*constant pairing*" makes the formatting of functions with 
keyword arguments come out looking good.  It also formats Clojure specs 
very effectively.


4. Some people "*justify*" their let bindings, where the expressions that 
set the values for the locals all start in the same column. zprint can be 
configured to do that (though it doesn't by default), and sometimes it is 
nice.  Sometimes, not.  However, I extended this capability to maps, and 
for some maps output to the repl, the justify approach makes them look 
great.  Try (czprint nil :explain-justified) and compare it to (czprint nil 
:explain) and see what you think!  Still a bit slow for big or deeply 
nested maps, as if it causes the output to be longer than *not* justifying the 
map, it falls back to unjustified.  Another example:


This:


(zprint x)

{:code "58601", 

 :connection "2795", 

 :detail {:alternate "64:c1:2f:34", 

  :ident "64:c1:2f:34", 

  :interface "3.13.168.35", 

  :string "datacenter"}, 

 :direction :received, 

 :reference 14873, 

 :time 1425704001, 

 :type "get"}

 

or 

Re: [ANN] Clojure Programming Cookbook

2016-11-14 Thread Colin Yates
Congrats - it is amazing how much effort this takes :-).

On Tuesday, 15 November 2016, Nicolas Modrzyk  wrote:

> Hi Clojure people,
>
> So after one year and 23 days, (that would be 388 days) the IT book I was
> working on with Makoto (merci!) finally got published!
>
> It has been a long battle with many late nights to get it out, tough
> deadlines and never-ending reviews, but thanks to some skilled people at
> Packt, thank you Sachin, Pranav (and not forgetting Nikhil, you got it all
> started!) (http://packtpub.com/
> )
> it is finally there in all its 635 pages glory ;)
>
> (PACK) https://www.packtpub.com/application-development/
> clojure-programming-cookbook
>
> (AMAZON) http://a.co/3c9ckbp
>
> The book while also presenting Clojure language centric topics, wants to
> be slightly more focused around using Clojure at work and is bringing tons
> and tons of working examples for every day usage. Along its (long!) 10
> chapters, the book goes through many various topics but tries to keep each
> topic easy to follow, with fun and useful recipes for great projects and
> various creative ideas.
>
> The book may sometimes be too simple to many of the members of this
> mailing list, but we hope the book contribute to grow the Clojure community
> by sharing useful (and battled) Clojure code and stories.
>
> This is out now ! Enjoy!
> Nicolas & Makoto, all the way from Japan
>
> --
> 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 Programming Cookbook

2016-11-14 Thread Nicolas Modrzyk
Hi Clojure people,

So after one year and 23 days, (that would be 388 days) the IT book I was
working on with Makoto (merci!) finally got published!

It has been a long battle with many late nights to get it out, tough
deadlines and never-ending reviews, but thanks to some skilled people at
Packt, thank you Sachin, Pranav (and not forgetting Nikhil, you got it all
started!) (http://packtpub.com/
)
it is finally there in all its 635 pages glory ;)

(PACK)
https://www.packtpub.com/application-development/clojure-programming-cookbook

(AMAZON) http://a.co/3c9ckbp

The book while also presenting Clojure language centric topics, wants to be
slightly more focused around using Clojure at work and is bringing tons and
tons of working examples for every day usage. Along its (long!) 10
chapters, the book goes through many various topics but tries to keep each
topic easy to follow, with fun and useful recipes for great projects and
various creative ideas.

The book may sometimes be too simple to many of the members of this mailing
list, but we hope the book contribute to grow the Clojure community by
sharing useful (and battled) Clojure code and stories.

This is out now ! Enjoy!
Nicolas & Makoto, all the way from Japan

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


callback before evicting element from cache [core.cache]

2016-11-14 Thread anurag peshne
Hello,

I'm trying to use core.cache 

 as 
a open file cache. I want to close the file descriptor when the cache entry 
is removed. However, there is no way to pass any callback before an entry 
is evicted. Is there any other way of accomplishing this?

Thanks,
Anurag

-- 
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] invariant 0.1.0 – Invariants on Clojure Data Structures

2016-11-14 Thread Yannick Scherer
*Description*
 

> *invariant *is a library providing semantic invariants on Clojure data 
> structures. Built upon specter  it 
> allows for declarative definition and efficient
> resolution of data constraints, focusing on useful error reporting 
> capabilities. Additionally, invariants can be converted to clojure.spec 
>  specs.


*Release Notes*
https://github.com/xsc/invariant/releases/tag/v0.1.0

*Documentation*
https://xsc.github.io/invariant/

*Prior Work & Discussion*
https://groups.google.com/forum/#!topic/clojure/SfuoZXomZrs
https://groups.google.com/forum/#!topic/clojure/qbe3D4_6KnY

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