Re: 'get' behaviors

2017-05-30 Thread reborgml
Hi,

thanks for the clarification. Not sure #3 is worth a Jira either, is 
perhaps useful for a few and there are more important things I guess. #2 is 
a work in progress already and #1 it's by design. I'm just happy it is 
noted somewhere such as here and clojuredocs (done).

Thanks
Renzo

On Monday, 29 May 2017 22:21:59 UTC+1, Andy Fingerhut wrote:
>
>
>
> On Mon, May 29, 2017 at 1:20 PM, > wrote:
>>
>> On Monday, 29 May 2017 18:45:20 UTC+1, Nicola Mometto wrote:
>>>
>>> Issue #1 had been logged in CLJ-1242, but it was later decided to just 
>>> focus on making equality not throw as contains/get throwing is consistent 
>>> with java behaviour, see comments from Stu and Alex here 
>>> https://dev.clojure.org/jira/browse/CLJ-1242?focusedCommentId=40612&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-40612
>>>
>>
>> Mmmh, I see. I've also seen now that by forcing compare semantic the tree 
>> search can stay O(logN) average. Removing the compare constraint would make 
>> the search O(n/2) avg. So there is a point I guess.
>>
>
> I believe it is O(log N) worst case, as well as average case, via a 
> balanced binary tree implementation. 
>

>
>>> I'm not aware of any previous discussion on Issue #3 but IMO this is 
>>> consistent with clojure's GIGO behaviour
>>>
>>
>> It's kind of border line, because the doc refers to "map" and "key" as 
>> arguments but then it can also handle other associative things like 
>> vectors. nth correctly handles the outofbound. Perhaps get should do the 
>> same.
>>
>
> I have noticed this behavior before, but not brought it up in the group, 
> since my guess is that a programming mistake leading to an actual bug here 
> seems unlikely (i.e. you wouldn't accidentally get there from sequentially 
> walking through a list starting at 0 and incrementing by 1, because you'd 
> pretty much always hit the end of the vector/list/etc. first).  That and 
> the GIGO behavior that Nicola refers, and a focus on performance, combine 
> to mean it is unlikely that any change would be made to Clojure that leads 
> to a longer execution time for get when the index is in range (unlikely is 
> my guess -- I am not a person who makes these decisions, but have seen 
> several made in this direction before over the years).
>
> It may be more likely that the Clojure core team would be willing to 
> accept a change to clojure.spec that would check for such erroneous inputs 
> to get.  If you are interested, you could try creating a JIRA ticket for a 
> change like that.  You could mention in the ticket that a change to 
> clojure.core/get might be interesting, if someone can think of a way that 
> has no performance impact in the non-error case. 
>

> Andy
>
>
>
>> My 2C
>> Thanks
>>  
>>
>>>
>>> On 29/05/17 19:15, rebo...@gmail.com wrote:
>>>
>>> I was wondering if the following 'get' behaviors are worth a chat. 
>>> Apologies if this is known issue, but they don't seem impossible corner 
>>> cases to me.
>>>
>>> #1
>>>
>>> This one looks read-only access to me and I'm not sure why a suitable 
>>> comparator should be in place.
>>>
>>> (get (sorted-map :a 1 :b 2) "a" "not found");; ClassCastException
>>>
>>> #2
>>>
>>> 'get' is happy with other transients (namely vectors and maps) but fails 
>>> silently on sets:
>>>
>>> (get (transient #{0 1 2}) 1);; nil
>>>
>>> #3 (.intValue x) can throw away bits with precision loss. Sufficiently 
>>> large keys produce the following:
>>>
>>> (get ["a" "b" "c"] 4294967296) ;; "a"
>>>
>>> Thanks
>>> Renzo
>>>
>>> -- 
>>> 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.
>>>
>>>
>>> -- 
>> 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:/

[ANN] specter-edn 0.1.3 - Format-preserving transforms for EDN and CLJ

2017-05-30 Thread Jason Felice
More thanks to Marcelo!:

   - Fix for nils in collections
   - Fix for rebuilding of maps
   - Ensure whitespace between adjacent tokens after a transform

Also, the code in the README has been corrected.

specter-edn

https://github.com/maitria/specter-edn/

Format-preserving Specter path for EDN and Cloure code.

There is one specter path: SEXPRS. This navigates to a sequence of
s-expressions parsed from a string.

For the transform case, specter-edn preserves whitespace and comments using
a sort of diffing algorithm to match new S-expression parts to original
parts of the parse tree.
Usage

(use 'com.rpl.specter)
(use 'com.rpl.specter.macros)
(use 'specter-edn.core)

(select [SEXPRS FIRST LAST] "[42 26 77]");=> 77

(setval [SEXPRS FIRST FIRST] 99 "[42 ; Hi mom!\n6]");=> "[99 ; Hi mom!\n6]"

TODO

   - Use clj-format to format new code which isn't matched up with old code.

Contributors

   - Jason Felice
   - Marcelo Nomoto

License

Copyright © 2016, 2017 Jason M. Felice

Distributed under the Eclipse Public License either version 1.0 or (at your
option) any later version.

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


testing println in clojure.test

2017-05-30 Thread Kevin Kleinfelter
I've got a function which is supposed to println a computed value.  How do 
I test whether it printed that value, when using clojure.test?

Or, another way of asking the same question is how do I grab the output 
from println when testing a function with clojure.test?

TIA

-- 
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: testing println in clojure.test

2017-05-30 Thread Andy Fingerhut
The with-out-str macro should be able to do this for you.  A few examples
of use can be found on ClojureDocs here:

https://clojuredocs.org/clojure.core/with-out-str

You may find the Clojure cheat sheet useful for discovering things like
this (at least for things the cheat sheet includes -- it doesn't cover any
but a tiny handful of functions outside of Clojure core functionality).  In
particular for your question, the section titled "IO" (i.e. Input/Output),
subsection "to string" would have helped:

https://clojure.org/api/cheatsheet

Andy

On Tue, May 30, 2017 at 2:43 PM, Kevin Kleinfelter <
kleinfelter.gro...@gmail.com> wrote:

> I've got a function which is supposed to println a computed value.  How do
> I test whether it printed that value, when using clojure.test?
>
> Or, another way of asking the same question is how do I grab the output
> from println when testing a function with clojure.test?
>
> TIA
>
> --
> 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] Certificaat, a Let's Encrypt client

2017-05-30 Thread Daniel Szmulewicz
Hello everybody, 

I'm happy to announce Certificaat , 
a general-purpose ACME  
client, fully compatible with the Let’s Encrypt  
CA.

Typically, Let's Encrypt certificates are valid for 90 days. Certificaat 
runs on the command line and can be integrated in automated workflows to 
renew certificates as needed.

Additionally, Certificaat offers a set of Boot tasks, enabling certificate 
management in build scripts.

Thank you!

Daniel

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