Re: [ANN] CIDER 0.12 (Seattle)

2016-04-18 Thread Mimmo Cosenza
a thousand thanks for the Clojure Interactive Development Environement that 
Rocks!
mimmo

> On 18 Apr 2016, at 08:17, Andrea Russo  wrote:
> 
> Awesome! Thank you very much!
> 
> Il 18/apr/2016 03:50, "Timothy Washington"  > ha scritto:
> +1. Great work :)
> 
> 
> Tim 
> 
> 
> On Sat, Apr 16, 2016 at 7:54 PM, Bozhidar Batsov  > wrote:
> Hey everyone,
> 
> CIDER 0.12 (Seattle) is out! It packs a lot of small improvements and bug 
> fixes!
> 
> Check out the release notes here 
> https://github.com/clojure-emacs/cider/releases/tag/v0.12.0 
> 
> 
> We've also got a brand new user manual 
> http://cider.readthedocs.org/en/stable/ 
>  for your
> consideration. We'd love to get some help and feedback to make it better. 
> 
> Enjoy!
> 
> 
> 
> -- 
> 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 
> .

-- 
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] CIDER 0.12 (Seattle)

2016-04-18 Thread Leon Grapenthin
Is there still a one page version of the manual so that I can use full text 
search like on the old README? Asking beacuse the readthedocs search 
function returns 0 results for "shortcut" or "shortcuts".

Besides thank you very much.

On Sunday, April 17, 2016 at 4:54:44 AM UTC+2, Bozhidar Batsov wrote:
>
> Hey everyone,
>
> CIDER 0.12 (Seattle) is out! It packs a lot of small improvements and bug 
> fixes!
>
> Check out the release notes here 
> https://github.com/clojure-emacs/cider/releases/tag/v0.12.0
>
> We've also got a brand new user manual 
> http://cider.readthedocs.org/en/stable/ for your
> consideration. We'd love to get some help and feedback to make it better. 
>
> Enjoy!
>

-- 
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: Pmap on hash maps

2016-04-18 Thread myriam abramson
I like pmap too. I've set the number of processors call with a defonce to
minimize the calls to this function to speed up pmap. What do ya think?

(defn rt-num-processors []
  (.availableProcessors (Runtime/getRuntime)))

(defonce num-processors (rt-num-processors))


On Mon, Apr 18, 2016 at 1:31 AM, Mars0i  wrote:

> On Sunday, April 17, 2016 at 4:23:32 PM UTC-5, JvJ wrote:
>>
>> Orders of magnitude?  Is it even worth running things in parallel in this
>> case?
>>
>
> I got a 2X-5X speed improvement with pmap, but as adrian says, it depends.
>
> The nice thing about  pmap, though, is that using it just involves adding
> a "p" to the front of a map call.  So if you're already using map for
> something, it's easy to test whether pmap helps (preferably using
> Criterium ).
>
> One thing that can help make pmap worthwhile is rearranging code so that
> the function passed to a single map/pmap call does a lot of work with each
> element of the collection passed to it.  If the amount of computation for
> each element is sufficiently high, pmap will be faster.e.g. rather than
> (map f1 (map f2 (map f3 my-collection))), do (map (comp f1 f2 f3)
> my-collection), and then try adding the "p" on the front.  This avoids
> constructing unnecessary intermediate sequences, too.
>
> --
> 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.


Re: [ANN] CIDER 0.12 (Seattle)

2016-04-18 Thread Bozhidar Batsov
On 18 April 2016 at 03:22, Leon Grapenthin  wrote:

> Is there still a one page version of the manual so that I can use full
> text search like on the old README?
>

Nope, there's not a single page version of the manual anymore.



> Asking beacuse the readthedocs search function returns 0 results for
> "shortcut" or "shortcuts".
>

That's a known bug in readthedocs when using mkdocs to generate the docs.
Eventually we'll either switch to sphinx or change the manual's hosting.
Unfortunately I don't have time to deal with this right now. As a
workaround you can grep in the markdown code of the manual.


>
> Besides thank you very much.
>


>
> On Sunday, April 17, 2016 at 4:54:44 AM UTC+2, Bozhidar Batsov wrote:
>>
>> Hey everyone,
>>
>> CIDER 0.12 (Seattle) is out! It packs a lot of small improvements and bug
>> fixes!
>>
>> Check out the release notes here
>> https://github.com/clojure-emacs/cider/releases/tag/v0.12.0
>>
>> We've also got a brand new user manual
>> http://cider.readthedocs.org/en/stable/ for your
>> consideration. We'd love to get some help and feedback to make it better.
>>
>> Enjoy!
>>
>

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


Validation Benchmark

2016-04-18 Thread Atamert Ölçgen
Hi All,

I have been working a benchmark for (runtime) validation libraries. I think
it is mature enough to share the results with the group.

The repo is here: https://github.com/muhuk/validation-benchmark

Raw benchmark output as EDN is here:
https://gist.github.com/muhuk/93d7d9e46bf5191310aaa4557379d10e

More human readable results are in my blog:
http://blog.muhuk.com/2016/04/18/performance_comparison_of_annotate_herbert_schema.html

If you are familiar with Annotate, Herbert or Schema, please take a quick
look at their implementations:
https://github.com/muhuk/validation-benchmark/tree/master/src/validation_benchmark/lib

Also contributions of other validation libraries are most welcome!

-

As an aside: what is the group policy for attachments? Would it be ok if I
attached images of benchmark results?

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


Recur in an overloaded function does not work?

2016-04-18 Thread andmed
Hello

I am just a beginner Clojure programmer and I am unhappy with the way recur 
behaves in Clojure

I have implemented kata from 
here https://github.com/alvarogarcia7/kata-formulation-find-comments/pull/3
What it does: it outputs 'comments' (sequences starting with "#" or "//") 
and ignores 'comments' in quotes

Here is the code:

(def comment-s '("#" "//"))
(def quote-s '("'" "\""))

(defn comment-s? [s]
  (filter #(.startsWith s %) comment-s))

(defn quote-s? [s]
   (filter #(.startsWith s %) quote-s))

(defn find-comment-in-line
  "We implement a FSM via an overloaded function -- when inside a quote, 
pass two arguments, including opening quote symb, otherwise just one 
(string itself). Don't know yet hot to recur in an 
([s] (when (pos? (count s))
  (if-let [cs (seq (comment-s? s))]
  (subs s (count (first cs))) ; yes, a comment symbol found, just 
return the remainder of a string
  (if-let [qs (seq (quote-s? s))] ; no, lets check for an opening 
quote
  (find-comment-in-line (subs s 1) qs) ; yes, an opening quote 
found, now go look for an end quote
  (find-comment-in-line (subs s 1)) ; no, just some other 
symbol found, check for the rest
 ([s q] (when (pos? (count s))
   (if-let [qs (seq (quote-s? s))] ; lets check if it is a quote
 (if (= qs q) ; is it a closing quote?
   (find-comment-in-line (subs s 1)) ; yes, lets check for the rest
   (find-comment-in-line (subs s 1) q)) ; no, just ignore the 
symbol, continue looking for a closing quote

 My idea was to make it via recur: it does not work however because recur 
apparently binds to an implementation with particular number of arguments, 
not to a function call, and I can not see any reason why it would not.

With recur I was getting 
Caused by: java.lang.IllegalArgumentException: Mismatched argument count to 
recur, expected: 1 args, got: 2


I guess the code is a bit "imperative" and imperative programmer I am. 
Also, I can make recur work with a nullable argument and a helper function, 
still... is there any reason Clojure can not bind recur to a function call 
in accordance with the number of arguments passed?

-- 
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: Recur in an overloaded function does not work?

2016-04-18 Thread adrian . medina
Each arity defined for a particular Clojure function is actually a separate 
"method" under the hood for that particular functional instance. `recur` in 
Clojure should be thought of as more like a primitive looping construct 
than a recursive call to some named function.

The documentation for the recur special form explains this in more 
detail: http://clojure.org/reference/special_forms#recur. 

On Monday, April 18, 2016 at 4:16:30 PM UTC-4, andmed wrote:
>
> Hello
>
> I am just a beginner Clojure programmer and I am unhappy with the way 
> recur behaves in Clojure
>
> I have implemented kata from here 
> https://github.com/alvarogarcia7/kata-formulation-find-comments/pull/3
> What it does: it outputs 'comments' (sequences starting with "#" or "//") 
> and ignores 'comments' in quotes
>
> Here is the code:
>
> (def comment-s '("#" "//"))
> (def quote-s '("'" "\""))
>
> (defn comment-s? [s]
>   (filter #(.startsWith s %) comment-s))
>
> (defn quote-s? [s]
>(filter #(.startsWith s %) quote-s))
>
> (defn find-comment-in-line
>   "We implement a FSM via an overloaded function -- when inside a quote, 
> pass two arguments, including opening quote symb, otherwise just one 
> (string itself). Don't know yet hot to recur in an 
> ([s] (when (pos? (count s))
>   (if-let [cs (seq (comment-s? s))]
>   (subs s (count (first cs))) ; yes, a comment symbol found, just 
> return the remainder of a string
>   (if-let [qs (seq (quote-s? s))] ; no, lets check for an opening 
> quote
>   (find-comment-in-line (subs s 1) qs) ; yes, an opening quote 
> found, now go look for an end quote
>   (find-comment-in-line (subs s 1)) ; no, just some other 
> symbol found, check for the rest
>  ([s q] (when (pos? (count s))
>(if-let [qs (seq (quote-s? s))] ; lets check if it is a quote
>  (if (= qs q) ; is it a closing quote?
>(find-comment-in-line (subs s 1)) ; yes, lets check for the rest
>(find-comment-in-line (subs s 1) q)) ; no, just ignore the 
> symbol, continue looking for a closing quote
>
>  My idea was to make it via recur: it does not work however because recur 
> apparently binds to an implementation with particular number of arguments, 
> not to a function call, and I can not see any reason why it would not.
>
> With recur I was getting 
> Caused by: java.lang.IllegalArgumentException: Mismatched argument count 
> to recur, expected: 1 args, got: 2
>
>
> I guess the code is a bit "imperative" and imperative programmer I am. 
> Also, I can make recur work with a nullable argument and a helper function, 
> still... is there any reason Clojure can not bind recur to a function call 
> in accordance with the number of arguments passed?
>
>

-- 
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: Recur in an overloaded function does not work?

2016-04-18 Thread James Elliott
And the reason for this is to be able to simulate tail-call optimization 
even though the Java VM doesn’t natively support that; recur can allow you 
to express things in a style that looks recursive, but does not suffer from 
stack space limitations that actual recursive calls do. If you actually 
want to perform a recursive call, you can simply do so by calling the 
function normally, without using recur.

On Monday, April 18, 2016 at 3:47:10 PM UTC-5, adrian...@mail.yu.edu wrote:
>
> Each arity defined for a particular Clojure function is actually a 
> separate "method" under the hood for that particular functional instance. 
> `recur` in Clojure should be thought of as more like a primitive looping 
> construct than a recursive call to some named function.
>
> The documentation for the recur special form explains this in more detail: 
> http://clojure.org/reference/special_forms#recur. 
>
> On Monday, April 18, 2016 at 4:16:30 PM UTC-4, andmed wrote:
>>
>> Hello
>>
>> I am just a beginner Clojure programmer and I am unhappy with the way 
>> recur behaves in Clojure
>>
>> I have implemented kata from here 
>> https://github.com/alvarogarcia7/kata-formulation-find-comments/pull/3
>> What it does: it outputs 'comments' (sequences starting with "#" or "//") 
>> and ignores 'comments' in quotes
>>
>> Here is the code:
>>
>> (def comment-s '("#" "//"))
>> (def quote-s '("'" "\""))
>>
>> (defn comment-s? [s]
>>   (filter #(.startsWith s %) comment-s))
>>
>> (defn quote-s? [s]
>>(filter #(.startsWith s %) quote-s))
>>
>> (defn find-comment-in-line
>>   "We implement a FSM via an overloaded function -- when inside a quote, 
>> pass two arguments, including opening quote symb, otherwise just one 
>> (string itself). Don't know yet hot to recur in an 
>> ([s] (when (pos? (count s))
>>   (if-let [cs (seq (comment-s? s))]
>>   (subs s (count (first cs))) ; yes, a comment symbol found, just 
>> return the remainder of a string
>>   (if-let [qs (seq (quote-s? s))] ; no, lets check for an opening 
>> quote
>>   (find-comment-in-line (subs s 1) qs) ; yes, an opening 
>> quote found, now go look for an end quote
>>   (find-comment-in-line (subs s 1)) ; no, just some other 
>> symbol found, check for the rest
>>  ([s q] (when (pos? (count s))
>>(if-let [qs (seq (quote-s? s))] ; lets check if it is a quote
>>  (if (= qs q) ; is it a closing quote?
>>(find-comment-in-line (subs s 1)) ; yes, lets check for the 
>> rest
>>(find-comment-in-line (subs s 1) q)) ; no, just ignore the 
>> symbol, continue looking for a closing quote
>>
>>  My idea was to make it via recur: it does not work however because recur 
>> apparently binds to an implementation with particular number of arguments, 
>> not to a function call, and I can not see any reason why it would not.
>>
>> With recur I was getting 
>> Caused by: java.lang.IllegalArgumentException: Mismatched argument count 
>> to recur, expected: 1 args, got: 2
>>
>>
>> I guess the code is a bit "imperative" and imperative programmer I am. 
>> Also, I can make recur work with a nullable argument and a helper function, 
>> still... is there any reason Clojure can not bind recur to a function call 
>> in accordance with the number of arguments passed?
>>
>>

-- 
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] CIDER 0.12 (Seattle)

2016-04-18 Thread hiskennyness

Pardon a noob question, but I just installed 0.12 and when I did C-x C-f 
intending to visit a new file Emacs insisted on opening an existing file 
that did not even match. eg, I typed a.clj and it opened evaluate.clj. I 
was trying to create cells_test.clj, typed that, and it opened (and showed 
with a red prompt that it would) cell_types_test.clj.

ISTR it would say "No mathc once what I typed did not match and then prompt 
me to confirm and then create a buffer for the new file name.

Sorry if this is OT, and congrats on the new release!

-kenneth

On Saturday, April 16, 2016 at 10:54:44 PM UTC-4, Bozhidar Batsov wrote:
>
> Hey everyone,
>
> CIDER 0.12 (Seattle) is out! It packs a lot of small improvements and bug 
> fixes!
>
> Check out the release notes here 
> https://github.com/clojure-emacs/cider/releases/tag/v0.12.0
>
> We've also got a brand new user manual 
> http://cider.readthedocs.org/en/stable/ for your
> consideration. We'd love to get some help and feedback to make it better. 
>
> Enjoy!
>

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


Possible to override assoc-in or update-in?

2016-04-18 Thread JvJ
I'm implementing a map data structure where most of the values are maps or 
sets, and these values can be cross-indexed by the keys they contain.  I don't 
know if it already has a name, but I'm calling it a cross-map.  It's similar to 
a two-way map, but they're not the same thing.

For instance, a common operation would be something like "give me all values of 
this map that contain the key :a."

In order to do this efficiently, I'm maintaining a second map that maps keys in 
the values of the main map to keys of the main map whose values contain that 
key.

If that sounds confusing, consider this:
main-map: 
{:foo {:a 1 :b 2} :bar {:a 2 :c 4} :baz {:b 3 :c 5}}

Corresponding cross-indices:
{:a #{:foo :bar} :b #{:foo :baz} :c #{:bar :baz}}

As you can see, each key maintains references to those entries where it is 
found.

When a nested update occurs that adds an entry to one of the main map's values, 
the efficient thing to do would be to simply conj that new key onto its 
corresponding cross-index set.

However, I am trying to implement this as a clojure IPersistentMap, and the 
only method I can override is assoc, not assoc-in.

Using regular assoc, I would have to compare the old value's keys to the new 
value's keys and find the set difference of the two, which is not an O(1) 
operation.

Is there any way to override the behaviour of nested associations or updates?

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: Possible to override assoc-in or update-in?

2016-04-18 Thread Timothy Baldridge
assoc-in is defined in terms of assoc:
https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj#L5901

And this structure is fairly common these days, it's basically a index of
tuples [e a v], and you're creating a eav index and then an av index.
Datomic does this same sort of thing, for the datom [e a v t] it creates
indices for :eavt :avet and a few others that escape my memory at the
moment.

On Mon, Apr 18, 2016 at 5:08 PM, JvJ  wrote:

> I'm implementing a map data structure where most of the values are maps or
> sets, and these values can be cross-indexed by the keys they contain.  I
> don't know if it already has a name, but I'm calling it a cross-map.  It's
> similar to a two-way map, but they're not the same thing.
>
> For instance, a common operation would be something like "give me all
> values of this map that contain the key :a."
>
> In order to do this efficiently, I'm maintaining a second map that maps
> keys in the values of the main map to keys of the main map whose values
> contain that key.
>
> If that sounds confusing, consider this:
> main-map:
> {:foo {:a 1 :b 2} :bar {:a 2 :c 4} :baz {:b 3 :c 5}}
>
> Corresponding cross-indices:
> {:a #{:foo :bar} :b #{:foo :baz} :c #{:bar :baz}}
>
> As you can see, each key maintains references to those entries where it is
> found.
>
> When a nested update occurs that adds an entry to one of the main map's
> values, the efficient thing to do would be to simply conj that new key onto
> its corresponding cross-index set.
>
> However, I am trying to implement this as a clojure IPersistentMap, and
> the only method I can override is assoc, not assoc-in.
>
> Using regular assoc, I would have to compare the old value's keys to the
> new value's keys and find the set difference of the two, which is not an
> O(1) operation.
>
> Is there any way to override the behaviour of nested associations or
> updates?
>
> 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.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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: Possible to override assoc-in or update-in?

2016-04-18 Thread Timothy Baldridge
And by "fairly common these days", I mean that I run into this sort of
structure a lot in clojure with anything that is trying to logic or query
operations. Probably isn't that common outside of projects in that domain.

On Mon, Apr 18, 2016 at 5:28 PM, Timothy Baldridge 
wrote:

> assoc-in is defined in terms of assoc:
> https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj#L5901
>
> And this structure is fairly common these days, it's basically a index of
> tuples [e a v], and you're creating a eav index and then an av index.
> Datomic does this same sort of thing, for the datom [e a v t] it creates
> indices for :eavt :avet and a few others that escape my memory at the
> moment.
>
> On Mon, Apr 18, 2016 at 5:08 PM, JvJ  wrote:
>
>> I'm implementing a map data structure where most of the values are maps
>> or sets, and these values can be cross-indexed by the keys they contain.  I
>> don't know if it already has a name, but I'm calling it a cross-map.  It's
>> similar to a two-way map, but they're not the same thing.
>>
>> For instance, a common operation would be something like "give me all
>> values of this map that contain the key :a."
>>
>> In order to do this efficiently, I'm maintaining a second map that maps
>> keys in the values of the main map to keys of the main map whose values
>> contain that key.
>>
>> If that sounds confusing, consider this:
>> main-map:
>> {:foo {:a 1 :b 2} :bar {:a 2 :c 4} :baz {:b 3 :c 5}}
>>
>> Corresponding cross-indices:
>> {:a #{:foo :bar} :b #{:foo :baz} :c #{:bar :baz}}
>>
>> As you can see, each key maintains references to those entries where it
>> is found.
>>
>> When a nested update occurs that adds an entry to one of the main map's
>> values, the efficient thing to do would be to simply conj that new key onto
>> its corresponding cross-index set.
>>
>> However, I am trying to implement this as a clojure IPersistentMap, and
>> the only method I can override is assoc, not assoc-in.
>>
>> Using regular assoc, I would have to compare the old value's keys to the
>> new value's keys and find the set difference of the two, which is not an
>> O(1) operation.
>>
>> Is there any way to override the behaviour of nested associations or
>> updates?
>>
>> 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.
>>
>
>
>
> --
> “One of the main causes of the fall of the Roman Empire was that–lacking
> zero–they had no way to indicate successful termination of their C
> programs.”
> (Robert Firth)
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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: Possible to override assoc-in or update-in?

2016-04-18 Thread JvJ
Can you point me to a working example of one of these structures?

On Monday, 18 April 2016 16:30:17 UTC-7, tbc++ wrote:
>
> And by "fairly common these days", I mean that I run into this sort of 
> structure a lot in clojure with anything that is trying to logic or query 
> operations. Probably isn't that common outside of projects in that domain. 
>
> On Mon, Apr 18, 2016 at 5:28 PM, Timothy Baldridge  > wrote:
>
>> assoc-in is defined in terms of assoc: 
>> https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj#L5901
>>
>> And this structure is fairly common these days, it's basically a index of 
>> tuples [e a v], and you're creating a eav index and then an av index. 
>> Datomic does this same sort of thing, for the datom [e a v t] it creates 
>> indices for :eavt :avet and a few others that escape my memory at the 
>> moment.  
>>
>> On Mon, Apr 18, 2016 at 5:08 PM, JvJ > 
>> wrote:
>>
>>> I'm implementing a map data structure where most of the values are maps 
>>> or sets, and these values can be cross-indexed by the keys they contain.  I 
>>> don't know if it already has a name, but I'm calling it a cross-map.  It's 
>>> similar to a two-way map, but they're not the same thing.
>>>
>>> For instance, a common operation would be something like "give me all 
>>> values of this map that contain the key :a."
>>>
>>> In order to do this efficiently, I'm maintaining a second map that maps 
>>> keys in the values of the main map to keys of the main map whose values 
>>> contain that key.
>>>
>>> If that sounds confusing, consider this:
>>> main-map:
>>> {:foo {:a 1 :b 2} :bar {:a 2 :c 4} :baz {:b 3 :c 5}}
>>>
>>> Corresponding cross-indices:
>>> {:a #{:foo :bar} :b #{:foo :baz} :c #{:bar :baz}}
>>>
>>> As you can see, each key maintains references to those entries where it 
>>> is found.
>>>
>>> When a nested update occurs that adds an entry to one of the main map's 
>>> values, the efficient thing to do would be to simply conj that new key onto 
>>> its corresponding cross-index set.
>>>
>>> However, I am trying to implement this as a clojure IPersistentMap, and 
>>> the only method I can override is assoc, not assoc-in.
>>>
>>> Using regular assoc, I would have to compare the old value's keys to the 
>>> new value's keys and find the set difference of the two, which is not an 
>>> O(1) operation.
>>>
>>> Is there any way to override the behaviour of nested associations or 
>>> updates?
>>>
>>> Thanks
>>>
>>> --
>>> 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 the Google 
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to clojure+u...@googlegroups.com .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> “One of the main causes of the fall of the Roman Empire was that–lacking 
>> zero–they had no way to indicate successful termination of their C 
>> programs.”
>> (Robert Firth) 
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>

-- 
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: Possible to override assoc-in or update-in?

2016-04-18 Thread Timothy Baldridge
Core.logic has one such implementation:
https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/pldb.clj
might be a place to start.

On Mon, Apr 18, 2016 at 5:35 PM, JvJ  wrote:

> Can you point me to a working example of one of these structures?
>
> On Monday, 18 April 2016 16:30:17 UTC-7, tbc++ wrote:
>>
>> And by "fairly common these days", I mean that I run into this sort of
>> structure a lot in clojure with anything that is trying to logic or query
>> operations. Probably isn't that common outside of projects in that domain.
>>
>> On Mon, Apr 18, 2016 at 5:28 PM, Timothy Baldridge 
>> wrote:
>>
>>> assoc-in is defined in terms of assoc:
>>> https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj#L5901
>>>
>>> And this structure is fairly common these days, it's basically a index
>>> of tuples [e a v], and you're creating a eav index and then an av index.
>>> Datomic does this same sort of thing, for the datom [e a v t] it creates
>>> indices for :eavt :avet and a few others that escape my memory at the
>>> moment.
>>>
>>> On Mon, Apr 18, 2016 at 5:08 PM, JvJ  wrote:
>>>
 I'm implementing a map data structure where most of the values are maps
 or sets, and these values can be cross-indexed by the keys they contain.  I
 don't know if it already has a name, but I'm calling it a cross-map.  It's
 similar to a two-way map, but they're not the same thing.

 For instance, a common operation would be something like "give me all
 values of this map that contain the key :a."

 In order to do this efficiently, I'm maintaining a second map that maps
 keys in the values of the main map to keys of the main map whose values
 contain that key.

 If that sounds confusing, consider this:
 main-map:
 {:foo {:a 1 :b 2} :bar {:a 2 :c 4} :baz {:b 3 :c 5}}

 Corresponding cross-indices:
 {:a #{:foo :bar} :b #{:foo :baz} :c #{:bar :baz}}

 As you can see, each key maintains references to those entries where it
 is found.

 When a nested update occurs that adds an entry to one of the main map's
 values, the efficient thing to do would be to simply conj that new key onto
 its corresponding cross-index set.

 However, I am trying to implement this as a clojure IPersistentMap, and
 the only method I can override is assoc, not assoc-in.

 Using regular assoc, I would have to compare the old value's keys to
 the new value's keys and find the set difference of the two, which is not
 an O(1) operation.

 Is there any way to override the behaviour of nested associations or
 updates?

 Thanks

 --
 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 the Google
 Groups "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> --
>>> “One of the main causes of the fall of the Roman Empire was that–lacking
>>> zero–they had no way to indicate successful termination of their C
>>> programs.”
>>> (Robert Firth)
>>>
>>
>>
>>
>> --
>> “One of the main causes of the fall of the Roman Empire was that–lacking
>> zero–they had no way to indicate successful termination of their C
>> programs.”
>> (Robert Firth)
>>
> --
> 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.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

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

[ANN] Arachne, a new rapid web development framework for Clojure

2016-04-18 Thread Luke VanderHart
Just realized I forgot to post about this here, which is kind of important. 
:)

It is still under development - I am raising funds via Kickstarter in order 
to get the opportunity to work on it full time and make sure it gets off to 
a really solid start.

It's a pretty ambitious project, but I've had some amazing minds generously 
agree to help me think through it at the high level. I'm optimistic that 
not only can we bring Clojure up to par with other language/framework 
stacks out there, but advance the state of the art in web development as a 
whole.

The steering and advisory group consists of:

- Tim Ewald 
- Jamie Kite
- David Nolen
- Mike Nygard
- Russ Olsen
- Nola Stowe
- Stuart Sierra

Check it out, and please consider donating if you have the resources to do 
so: 
https://www.kickstarter.com/projects/1346708779/arachne-rapid-web-development-for-clojure

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.


[ANN] Kern 1.0 parsing library

2016-04-18 Thread Armando Blancas
Release 1.0 updates dependencies and gets rid of a name collision with cat.

These functions will let you write code that resembles the grammar you're 
parsing. I've found it useful for interpreters, translators and DSL's.

repo: https://github.com/blancas/kern
docs: https://github.com/blancas/kern/wiki
API: http://blancas.github.io/kern/

-- 
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] CIDER 0.12 (Seattle)

2016-04-18 Thread Artur Malabarba
Sounds like you've installed some aggressive completion engine like helm or
avy.

Cheers
Artur
On Mon, 18 Apr 2016 7:10 pm hiskennyness,  wrote:

>
> Pardon a noob question, but I just installed 0.12 and when I did C-x C-f
> intending to visit a new file Emacs insisted on opening an existing file
> that did not even match. eg, I typed a.clj and it opened evaluate.clj. I
> was trying to create cells_test.clj, typed that, and it opened (and showed
> with a red prompt that it would) cell_types_test.clj.
>
> ISTR it would say "No mathc once what I typed did not match and then
> prompt me to confirm and then create a buffer for the new file name.
>
> Sorry if this is OT, and congrats on the new release!
>
> -kenneth
>
> On Saturday, April 16, 2016 at 10:54:44 PM UTC-4, Bozhidar Batsov wrote:
>>
>> Hey everyone,
>>
>> CIDER 0.12 (Seattle) is out! It packs a lot of small improvements and bug
>> fixes!
>>
>> Check out the release notes here
>> https://github.com/clojure-emacs/cider/releases/tag/v0.12.0
>>
>> We've also got a brand new user manual
>> http://cider.readthedocs.org/en/stable/ for your
>> consideration. We'd love to get some help and feedback to make it better.
>>
>> Enjoy!
>>
> --
> 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.


Re: Validation Benchmark

2016-04-18 Thread Jason Wolfe
Thanks for putting this together!  

For schema, I think using `s/validate` is not a fair comparison with the 
other libraries -- as you mention, it throws an exception on error, and it 
also has to parse the schema each time.  

I think `s/checker` is the correct construct to use here -- it returns an 
error or nil for success (no exceptions), and only parses the schema once. 
 (This is what's used by `s/defn`, for example).  

Here's a pull request that implements this change:

https://github.com/muhuk/validation-benchmark/pull/6

I posted the updated results in the PR comments as well, which are 
qualitatively quite different from the ones currently reported in your blog 
post (with this change, schema is fastest on all but one benchmark, often 
by a factor of 3 or more).  

Please let me know if you have any questions. 

Thanks,
Jason


On Tuesday, April 19, 2016 at 2:47:33 AM UTC+7, Atamert Ölçgen wrote:
>
> Hi All,
>
> I have been working a benchmark for (runtime) validation libraries. I 
> think it is mature enough to share the results with the group.
>
> The repo is here: https://github.com/muhuk/validation-benchmark
>
> Raw benchmark output as EDN is here: 
> https://gist.github.com/muhuk/93d7d9e46bf5191310aaa4557379d10e
>
> More human readable results are in my blog: 
> http://blog.muhuk.com/2016/04/18/performance_comparison_of_annotate_herbert_schema.html
>
> If you are familiar with Annotate, Herbert or Schema, please take a quick 
> look at their implementations: 
> https://github.com/muhuk/validation-benchmark/tree/master/src/validation_benchmark/lib
>
> Also contributions of other validation libraries are most welcome!
>
> -
>
> As an aside: what is the group policy for attachments? Would it be ok if I 
> attached images of benchmark results?
>
> -- 
> 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.