Re: [ANN][Book] Clojure Recipes published and for sale on Amazon

2015-10-24 Thread Julian
Thanks everyone. 

On Thursday, 22 October 2015 22:52:25 UTC+11, Torsten Uhlmann wrote:
>
> Congratulations, Julian!
>
> Leonardo Borges > schrieb am Do., 22. 
> Okt. 2015 um 13:10 Uhr:
>
>> Congratulations Julian! I'll share this around!
>>
>> On Thu, Oct 22, 2015 at 9:51 PM Julian > 
>> wrote:
>>
>>> My book Clojure Recipes just got published and is for sale on Amazon! 
>>> http://clojurerecipes.net/
>>>
>>> http://www.amazon.com/Clojure-Recipes-Developers-Library-Julian/dp/0321927737/
>>>
>>> I've been working on it for about 2.5 years - I hope you find it useful! 
>>> (Or even better - I hope you know a friend that might find it useful.) 
>>>
>>> A little context in the form of Q&A below. 
>>>
>>> Cheers
>>> Julian
>>>
>>> *Q&A*
>>> *Haven't we got enough Clojure books already?*
>>> I asked this of Stuart Sierra when he was in down under 2 years ago. He 
>>> responded "we have enough 'introduction to Clojure books' but there is room 
>>> for other types of books". 
>>>
>>> *Who is it for?*
>>> This is a book for people who 'learn by doing'. It's for that guy in the 
>>> office who is interested in Clojure, and wants to use it to hack on a 
>>> project this weekend. (The assumption is you're familiar with Lisp-style 
>>> parens, but not much more.)
>>>
>>> The book contains 'starter projects' for various use-cases of a 
>>> small-to-medium size - it will hold your hand enough to get you started, 
>>> and then free you up to take your project as you choose. Each one is 
>>> self-contained, and assumes little Clojure knowledge, and explains the code 
>>> as you go. 
>>>
>>> *What? Clojure Recipes? Isn't there already a Clojure book in this 
>>> format?*
>>> I signed the contract in December 2012 with Pearson. At that time there 
>>> wasn't a Clojure book in this genre. 
>>>
>>> Then Ryan Neufeld announced he was writing a Clojure book in 2013. I got 
>>> in touch with Ryan and Justin Gehtland about the situation. They were both 
>>> amazingly generous and supportive, and clarified they could see differences 
>>> in the books intended purpose and content. I caught up with Ryan last year 
>>> at the Clojure Conj and he was warm and encouraging. 
>>>
>>> I came away feeling really positive about the Clojure community. 
>>> Everyone wants to 'grow the pie' of involved people. 
>>>
>>> -- 
>>> 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://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: Libraries for dealing with DNS

2015-10-24 Thread Asim Jalis
Hi Kyle,

DNSJava is a stable implementation of DNS in Java.

http://www.dnsjava.org/

Here is the JavaDoc for doing DNS lookups:
http://www.dnsjava.org/doc/org/xbill/DNS/Lookup.html

Asim

On Tue, Sep 15, 2015 at 3:34 PM, Kyle Sexton  wrote:

> Does anyone have a recommendation or know of a good library to interact
> with DNS?  I've found com.brweber2/clj-dns, but it is dated and I get
> NullPointerExceptions doing basic lookups.
>
> --
> Kyle Sexton
>
> --
> 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}} defun 0.3.0-alapha: supports clojurescript

2015-10-24 Thread dennis zhuang
defun  is a macro to define clojure
functions with parameter pattern matching just like erlang or elixir based
on core.match.

https://github.com/killme2008/defun

Thanks to sander dijkhuis , it supports
clojurescript right now.

You can use it in clojurescript as below:

  (ns cljs-test.core
(:require [defun :refer-macros [defun]]))

  (defun count-down
([0] (println "Reach zero!"))
([n] (println n)
(recur (dec n

  (count-down 5)  #Count down from five to zero.


Have fun!


-- 
庄晓丹
Email:killme2...@gmail.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: ArithmeticException while using unchecked-multiply

2015-10-24 Thread Gary Fredericks
I once set out to make a ticket for it, but ended up not probably because 
it was going to take too much effort to describe or something. I was 
probably busy.

On Saturday, October 24, 2015 at 7:01:05 PM UTC-5, Gary Fredericks wrote:
>
> I've always thought this is bad behavior, since it's blatantly doing the 
> opposite of what the name advertises. I think either the boxed versions 
> should return the same result as the unboxed version, or (if the whole 
> point is to give good performance and so we don't want want users to be 
> able to accidentally use the unboxed versions) it should throw at 
> compile-time for boxed args.
>
> On Saturday, October 24, 2015 at 9:35:46 AM UTC-5, Andy Fingerhut wrote:
>>
>> I can't answer whether Clojure should do that.
>>
>> It is doing it because unchecked-multiply falls back to normal multiply, 
>> i.e. *, unless both of its arguments are primitive long values.  Even boxed 
>> Long values cause it to fall back to the behavior of *.  The same goes for 
>> unchecked-add and unchecked-subtract.
>>
>>
>> user=> (unchecked-multiply 243290200817664 21)
>> -4249290049419214848
>> user=> (unchecked-multiply 243290200817664 (Long. 21))
>>
>> ArithmeticException integer overflow 
>>  clojure.lang.Numbers.throwIntOverflow (Numbers.java:1501)
>>
>> Andy
>>
>>
>> On Fri, Oct 23, 2015 at 1:54 PM, Garrett Rowe  wrote:
>>
>>> Should `unchecked-multiply` throw an exception in this case? (see also: 
>>> http://stackoverflow.com/questions/33306984/why-does-my-hash-function-fail-with-arithmeticexception-integer-overflow-even/33308956#33308956
>>> )
>>>
>>> user> (reduce unchecked-multiply (range 1 22))
>>> ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow 
>>> (Numbers.java:1388)
>>>
>>> The loop-recur version also fails, unless you use a type hint:
>>>
>>> user> (loop [n 1
>>>  r (range 1 22)]
>>> (if-let [a (first r)]
>>>   (recur (unchecked-multiply n a) (next r))
>>>   n))
>>> ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow 
>>> (Numbers.java:1388)
>>>
>>> user> (loop [n 1
>>>  r (range 1 22)]
>>> (if-let [^long a (first r)]
>>>   (recur (unchecked-multiply n a) (next r))
>>>   n))
>>> -4249290049419214848
>>>
>>> -- 
>>> 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 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: ArithmeticException while using unchecked-multiply

2015-10-24 Thread Gary Fredericks
I've always thought this is bad behavior, since it's blatantly doing the 
opposite of what the name advertises. I think either the boxed versions 
should return the same result as the unboxed version, or (if the whole 
point is to give good performance and so we don't want want users to be 
able to accidentally use the unboxed versions) it should throw at 
compile-time for boxed args.

On Saturday, October 24, 2015 at 9:35:46 AM UTC-5, Andy Fingerhut wrote:
>
> I can't answer whether Clojure should do that.
>
> It is doing it because unchecked-multiply falls back to normal multiply, 
> i.e. *, unless both of its arguments are primitive long values.  Even boxed 
> Long values cause it to fall back to the behavior of *.  The same goes for 
> unchecked-add and unchecked-subtract.
>
>
> user=> (unchecked-multiply 243290200817664 21)
> -4249290049419214848
> user=> (unchecked-multiply 243290200817664 (Long. 21))
>
> ArithmeticException integer overflow 
>  clojure.lang.Numbers.throwIntOverflow (Numbers.java:1501)
>
> Andy
>
>
> On Fri, Oct 23, 2015 at 1:54 PM, Garrett Rowe  > wrote:
>
>> Should `unchecked-multiply` throw an exception in this case? (see also: 
>> http://stackoverflow.com/questions/33306984/why-does-my-hash-function-fail-with-arithmeticexception-integer-overflow-even/33308956#33308956
>> )
>>
>> user> (reduce unchecked-multiply (range 1 22))
>> ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow 
>> (Numbers.java:1388)
>>
>> The loop-recur version also fails, unless you use a type hint:
>>
>> user> (loop [n 1
>>  r (range 1 22)]
>> (if-let [a (first r)]
>>   (recur (unchecked-multiply n a) (next r))
>>   n))
>> ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow 
>> (Numbers.java:1388)
>>
>> user> (loop [n 1
>>  r (range 1 22)]
>> (if-let [^long a (first r)]
>>   (recur (unchecked-multiply n a) (next r))
>>   n))
>> -4249290049419214848
>>
>> -- 
>> 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 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: ArithmeticException while using unchecked-multiply

2015-10-24 Thread Andy Fingerhut
I can't answer whether Clojure should do that.

It is doing it because unchecked-multiply falls back to normal multiply,
i.e. *, unless both of its arguments are primitive long values.  Even boxed
Long values cause it to fall back to the behavior of *.  The same goes for
unchecked-add and unchecked-subtract.


user=> (unchecked-multiply 243290200817664 21)
-4249290049419214848
user=> (unchecked-multiply 243290200817664 (Long. 21))

ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow
(Numbers.java:1501)

Andy


On Fri, Oct 23, 2015 at 1:54 PM, Garrett Rowe  wrote:

> Should `unchecked-multiply` throw an exception in this case? (see also:
> http://stackoverflow.com/questions/33306984/why-does-my-hash-function-fail-with-arithmeticexception-integer-overflow-even/33308956#33308956
> )
>
> user> (reduce unchecked-multiply (range 1 22))
> ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow
> (Numbers.java:1388)
>
> The loop-recur version also fails, unless you use a type hint:
>
> user> (loop [n 1
>  r (range 1 22)]
> (if-let [a (first r)]
>   (recur (unchecked-multiply n a) (next r))
>   n))
> ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow
> (Numbers.java:1388)
>
> user> (loop [n 1
>  r (range 1 22)]
> (if-let [^long a (first r)]
>   (recur (unchecked-multiply n a) (next r))
>   n))
> -4249290049419214848
>
> --
> 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.