Re: java method overloading and clojure interop

2015-07-09 Thread Jo Geraerts


Op woensdag 8 juli 2015 05:20:51 UTC+2 schreef Herwig Hochleitner:
>
> The way I would do it: Define multiply as a function calling (.multiply 
> amount ^Number x), for higher order usage, and then add an :inline function 
> to its metadata, which returns `(.multiply ~amount ~x).
> That acts as a compiler macro, which inlines the call to .multiply, that 
> way, its parameter type can be assigned via local type inferrence (which 
> clojure does).
> See http://www.bytopia.org/2014/07/07/inline-functions-in-clojure/#sec-3
> Beware, that inline functions aren't public API and subject to change.
>
>
One more question. What does :inline-arities exactly do?

 

-- 
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: java method overloading and clojure interop

2015-07-09 Thread Herwig Hochleitner
:inline-arities tells the compiler, which arities (i.e. parameter counts)
should be inlined:
https://github.com/clojure/clojure/blob/9d70bc1051ec8117df6436e07474c586ea9e85b0/src/jvm/clojure/lang/Compiler.java#L6596

2015-07-09 9:49 GMT+02:00 Jo Geraerts :

>
>
> Op woensdag 8 juli 2015 05:20:51 UTC+2 schreef Herwig Hochleitner:
>>
>> The way I would do it: Define multiply as a function calling (.multiply
>> amount ^Number x), for higher order usage, and then add an :inline function
>> to its metadata, which returns `(.multiply ~amount ~x).
>> That acts as a compiler macro, which inlines the call to .multiply, that
>> way, its parameter type can be assigned via local type inferrence (which
>> clojure does).
>> See http://www.bytopia.org/2014/07/07/inline-functions-in-clojure/#sec-3
>> Beware, that inline functions aren't public API and subject to change.
>>
>>
> One more question. What does :inline-arities exactly do?
>
>
>
> --
> 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] lein-collisions: a plugin to find classpath collisions

2015-07-09 Thread Herwig Hochleitner
[lein-collisions "0.1.2"] now working properly with resource directories​

-- 
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] lein-collisions: a plugin to find classpath collisions

2015-07-09 Thread Kevin Corcoran
Hi Herwig,​

This looks nice, thanks for contributing. One question, though:

The projects on which I work already use lein's :pedantic? flag.  Is there
any reason we might want to use lein-collisions instead of :pedantic?

- Kevin

-- 
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: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-09 Thread gingersafflower

> As for the escaped quotes, you may be using pr or prn to print, or maybe 
you are 
> using pr-str to produce the string representation. I can't be sure. 

At the moment I create the string like this: 

document-as-string (str "{\"transaction-id\" : \"" transaction-id 
"\", \"message\" : \"" message "\"}")
document-as-byte-array (bytes (byte-array (map (comp byte int) 
document-as-string)))

The crazy thing is that this sometimes works, but other times the quote 
marks appear in Redis as escaped quote marks. As near as I can tell, the 
important factor is the length of the string. A short string is likely to 
have its quote marks escaped. A long string does not have its quote marks 
escaped. 

My co-worker is working on the Java app. I am working on the Clojure app. 
We can both adjust out apps freely, just so long as we can get data to and 
from each other, in a manner that allows us to eventually cast the data to 
and from JSON. 

Any suggestions are welcome. 






On Wednesday, July 8, 2015 at 8:58:53 PM UTC-4, Francis Avila wrote:
>
> Who is saving these strings, and who is reading them? Do you have complete 
> control over both apps, or does one of them need to be aligned with the 
> other?
>
> If the Java app is the baseline, you need to know the exact details of the 
> format of the data it saves. Just knowing "it's JSON" is not enough, 
> because there may be other data types (e.g. dates) that don't have native 
> JSON representations. (The go-to JSON de/encoder for clojure is cheshire: 
> https://github.com/dakrone/cheshire )
>
> I took a quick look at Jedis and the easy, default way of using it is with 
> strings. It will encode strings to UTF-8 before sending to Redis and decode 
> from UTF-8 on read. You can set raw byte arrays too (which will not be 
> altered in any way before sending), but it's not clear to me how it can 
> read out raw byte arrays. (I'm sure there's a way, but it's not immediately 
> obvious.)
>
> As for the escaped quotes, you may be using pr or prn to print, or maybe 
> you are using pr-str to produce the string representation. I can't be sure. 
>
> On Wednesday, July 8, 2015 at 5:31:27 PM UTC-5, gingers...@gmail.com 
> wrote:
>>
>> And I have another stupid question. Using the above code, I am sometimes 
>> getting strings in Redis that have escaped quotation marks, like this:
>>
>> " \"transaction-id\" : \" 1ec47c2e-21ee-427c-841c-80a0f89f55d7 \"  
>> \"debrief\" :  \" Susan Hilly at Citi called to get a quotation for 
>> discounted weekly car rental for approximately 3 cars per week, or 150 
>> rentals annually. \"  "
>>
>> Why is that happening? 
>>
>>
>>
>> On Wednesday, July 8, 2015 at 5:38:20 PM UTC-4, gingers...@gmail.com 
>> wrote:
>>>
>>> Francis Avila, 
>>>
>>> Thank you for your response. The Java app is using Jedis and the Clojure 
>>> app is using Carmine. I'm wondering if you can suggest what you think would 
>>> be the easiest way to allow these 2 apps to understand each other's strings?
>>>
>>> You were correct about how unsafe the above code was. I tested it for 
>>> less than 15 minutes and ran into the fact that a \n newline made a mess of 
>>> everything. 
>>>
>>>
>>>
>>> On Wednesday, July 8, 2015 at 5:15:35 PM UTC-4, Francis Avila wrote:

 You are running into Carmine's automatic nippy serialization. 
 https://github.com/ptaoussanis/carmine#serialization

 Redis only stores byte arrays (what it calls "strings"). Carmine uses 
 the nippy library (the meaning of "NPY" in your byte stream) to represent 
 rich types compactly as bytes. https://github.com/ptaoussanis/nippy

 If you give Carmine a byte array to store, it will store it directly 
 without nippy-encoding it. E.g. (.getBytes "{}" "UTF-8")

 BTW your document-as-string example is extremely unsafe: how will you 
 reliably read this message out again? e.g. what if the 'debrief' string 
 contains a single quote? Use a proper serialization format.

 So the key is to have both your Clojure and Java app store *bytes* in 
 Redis using the same serialization. You can store anything you want 
 (nippy, 
 utf-8-encoded json, fressian, bson, utf-8 xml, utf-16 java strings, 
 whatever) as long as it's bytes and it's read and written the same way in 
 all your apps.

 The Redis library your Java app is using may have its own automatic 
 de/serialization, too. You need to find out what it's doing and either 
 work 
 with this or turn it off, just like with Carmine.

 Nippy unfortunately does not have a Java API out of the box:  
 https://github.com/ptaoussanis/nippy/issues/66


 On Wednesday, July 8, 2015 at 3:35:49 PM UTC-5, gingers...@gmail.com 
 wrote:
>
>
> I am not sure if this is a Clojure question or a Java question. I 
> don't know Java, so I could use whatever help folks can offer. 
>
> "primitive string" here means what I can 

clojure don't support .clj source code file by utf-8.

2015-07-09 Thread Alex Woods
clojure don't support .clj source code file by utf-8.
it's ok when the .clj source code files by  ascii 

env:
windows7,jdk1.8u45,lein2.5.0

-- 
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] lein-collisions: a plugin to find classpath collisions

2015-07-09 Thread Herwig Hochleitner
2015-07-08 18:41 GMT+02:00 Kevin Corcoran :

>
> The projects on which I work already use lein's :pedantic? flag.  Is there
> any reason we might want to use lein-collisions instead of :pedantic?
>
>
Hi Kevin,

if I understand :pedantic correctly, it catches cases, where transitive
dependencies would be pulled in with different versions, e.g.
(ring/ring-core "1.1.0" vs "1.2.0")

lein-collisions is exactly complementary: It catches cases, where
_different_ artefacts provide the same classes or resources. An example is
ibdknox/tools.reader vs org.clojure/tools.reader.
Another increasingly common case is the resource data_readers.clj being
defined by multiple libraries.

## Examples

An experience report of why library repackages like the tools.reader
example are especially problematic::
Program fails because of an outdated tools.reader version. You think
"strange, why is the library pulling an old version", but insert the most
recent version anyway. It still fails. You randomly tweak dependencies,
suddenly it works (because the classpath order changed), until it doesn't
(most often in production). The actual problem has been the whole time that
ibdknox/tools.reader provides classes resources in clojure/tools/reader*,
but it's very hard to discovery this.

Another example: garden (the css library) depends on yuicompressor, which
packages (not depends on) an old version of rhino. With lein-collisions,
you immediately find out about this and can take measures, like I did here:
https://github.com/webnf/webnf/tree/master/compat.yuicompressor
Without it, you eventually will run into bugs relating to old rhino
versions, only it will take you a long time to figure it out, because
you'll be pretty sure to depend on the most recent version.

kind regards

-- 
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: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-09 Thread Francis Avila
your document-as-byte-array is wrong--it only handles ascii, and very
inefficiently too.

Just say (.getBytes document-as-string "UTF-8") to get a utf-8 encoding of
the string as a byte array.

On Thu, Jul 9, 2015 at 10:41 AM,  wrote:

>
> > As for the escaped quotes, you may be using pr or prn to print, or maybe
> you are
> > using pr-str to produce the string representation. I can't be sure.
>
> At the moment I create the string like this:
>
> document-as-string (str "{\"transaction-id\" : \"" transaction-id
> "\", \"message\" : \"" message "\"}")
> document-as-byte-array (bytes (byte-array (map (comp byte int)
> document-as-string)))
>
> The crazy thing is that this sometimes works, but other times the quote
> marks appear in Redis as escaped quote marks. As near as I can tell, the
> important factor is the length of the string. A short string is likely to
> have its quote marks escaped. A long string does not have its quote marks
> escaped.
>
> My co-worker is working on the Java app. I am working on the Clojure app.
> We can both adjust out apps freely, just so long as we can get data to and
> from each other, in a manner that allows us to eventually cast the data to
> and from JSON.
>
> Any suggestions are welcome.
>
>
>
>
>
>
> On Wednesday, July 8, 2015 at 8:58:53 PM UTC-4, Francis Avila wrote:
>>
>> Who is saving these strings, and who is reading them? Do you have
>> complete control over both apps, or does one of them need to be aligned
>> with the other?
>>
>> If the Java app is the baseline, you need to know the exact details of
>> the format of the data it saves. Just knowing "it's JSON" is not enough,
>> because there may be other data types (e.g. dates) that don't have native
>> JSON representations. (The go-to JSON de/encoder for clojure is cheshire:
>> https://github.com/dakrone/cheshire )
>>
>> I took a quick look at Jedis and the easy, default way of using it is
>> with strings. It will encode strings to UTF-8 before sending to Redis and
>> decode from UTF-8 on read. You can set raw byte arrays too (which will not
>> be altered in any way before sending), but it's not clear to me how it can
>> read out raw byte arrays. (I'm sure there's a way, but it's not immediately
>> obvious.)
>>
>> As for the escaped quotes, you may be using pr or prn to print, or maybe
>> you are using pr-str to produce the string representation. I can't be sure.
>>
>> On Wednesday, July 8, 2015 at 5:31:27 PM UTC-5, gingers...@gmail.com
>> wrote:
>>>
>>> And I have another stupid question. Using the above code, I am sometimes
>>> getting strings in Redis that have escaped quotation marks, like this:
>>>
>>> " \"transaction-id\" : \" 1ec47c2e-21ee-427c-841c-80a0f89f55d7 \"
>>> \"debrief\" :  \" Susan Hilly at Citi called to get a quotation for
>>> discounted weekly car rental for approximately 3 cars per week, or 150
>>> rentals annually. \"  "
>>>
>>> Why is that happening?
>>>
>>>
>>>
>>> On Wednesday, July 8, 2015 at 5:38:20 PM UTC-4, gingers...@gmail.com
>>> wrote:

 Francis Avila,

 Thank you for your response. The Java app is using Jedis and the
 Clojure app is using Carmine. I'm wondering if you can suggest what you
 think would be the easiest way to allow these 2 apps to understand each
 other's strings?

 You were correct about how unsafe the above code was. I tested it for
 less than 15 minutes and ran into the fact that a \n newline made a mess of
 everything.



 On Wednesday, July 8, 2015 at 5:15:35 PM UTC-4, Francis Avila wrote:
>
> You are running into Carmine's automatic nippy serialization.
> https://github.com/ptaoussanis/carmine#serialization
>
> Redis only stores byte arrays (what it calls "strings"). Carmine uses
> the nippy library (the meaning of "NPY" in your byte stream) to represent
> rich types compactly as bytes. https://github.com/ptaoussanis/nippy
>
> If you give Carmine a byte array to store, it will store it directly
> without nippy-encoding it. E.g. (.getBytes "{}" "UTF-8")
>
> BTW your document-as-string example is extremely unsafe: how will you
> reliably read this message out again? e.g. what if the 'debrief' string
> contains a single quote? Use a proper serialization format.
>
> So the key is to have both your Clojure and Java app store *bytes* in
> Redis using the same serialization. You can store anything you want 
> (nippy,
> utf-8-encoded json, fressian, bson, utf-8 xml, utf-16 java strings,
> whatever) as long as it's bytes and it's read and written the same way in
> all your apps.
>
> The Redis library your Java app is using may have its own automatic
> de/serialization, too. You need to find out what it's doing and either 
> work
> with this or turn it off, just like with Carmine.
>
> Nippy unfortunately does not have a Java API out of the box:
> https://github.com/ptaoussanis/nippy/

Re: [ANN] lein-collisions: a plugin to find classpath collisions

2015-07-09 Thread Herwig Hochleitner
​So long story short, you want both :pedantic and lein-collisions

-- 
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] lein-collisions: a plugin to find classpath collisions

2015-07-09 Thread Andy Fingerhut
Herwig:

Great examples of why lein-collisions is useful.

I think it would be helpful to include that text in your README on Github
somewhere.

Andy

On Thu, Jul 9, 2015 at 9:00 AM, Herwig Hochleitner 
wrote:

> 2015-07-08 18:41 GMT+02:00 Kevin Corcoran :
>
>>
>> The projects on which I work already use lein's :pedantic? flag.  Is
>> there any reason we might want to use lein-collisions instead of :pedantic?
>>
>>
> Hi Kevin,
>
> if I understand :pedantic correctly, it catches cases, where transitive
> dependencies would be pulled in with different versions, e.g.
> (ring/ring-core "1.1.0" vs "1.2.0")
>
> lein-collisions is exactly complementary: It catches cases, where
> _different_ artefacts provide the same classes or resources. An example is
> ibdknox/tools.reader vs org.clojure/tools.reader.
> Another increasingly common case is the resource data_readers.clj being
> defined by multiple libraries.
>
> ## Examples
>
> An experience report of why library repackages like the tools.reader
> example are especially problematic::
> Program fails because of an outdated tools.reader version. You think
> "strange, why is the library pulling an old version", but insert the most
> recent version anyway. It still fails. You randomly tweak dependencies,
> suddenly it works (because the classpath order changed), until it doesn't
> (most often in production). The actual problem has been the whole time that
> ibdknox/tools.reader provides classes resources in clojure/tools/reader*,
> but it's very hard to discovery this.
>
> Another example: garden (the css library) depends on yuicompressor, which
> packages (not depends on) an old version of rhino. With lein-collisions,
> you immediately find out about this and can take measures, like I did here:
> https://github.com/webnf/webnf/tree/master/compat.yuicompressor
> Without it, you eventually will run into bugs relating to old rhino
> versions, only it will take you a long time to figure it out, because
> you'll be pretty sure to depend on the most recent version.
>
> kind regards
>
> --
> 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] lein-collisions: a plugin to find classpath collisions

2015-07-09 Thread Kevin Corcoran
Herwig,

Thanks for the explanation!

-- 
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: clojure don't support .clj source code file by utf-8.

2015-07-09 Thread Daniel Compton
Hi Alex

You'll need to give us some more information about this to help us
troubleshoot what's going on. Can you share the file with us?
On Fri, 10 Jul 2015 at 3:59 AM Alex Woods  wrote:

> clojure don't support .clj source code file by utf-8.
> it's ok when the .clj source code files by  ascii
>
> env:
> windows7,jdk1.8u45,lein2.5.0
>
>  --
> 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.
>
-- 
--
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.


Re: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-09 Thread gingersafflower
I am sorry, I should have explained this sooner. When I do this: 

(.getBytes document-as-string "UTF-8")

The quote marks are always escaped. When I do this: 

document-as-byte-array (bytes (byte-array (map (comp byte int) 
document-as-string)))

The quote marks are sometimes escaped, but most of the time they are not. 

I need to avoid having those quote marks escaped. I am not clear what is 
causing the escaping. 




On Thursday, July 9, 2015 at 12:01:51 PM UTC-4, Francis Avila wrote:
>
> your document-as-byte-array is wrong--it only handles ascii, and very 
> inefficiently too.
>
> Just say (.getBytes document-as-string "UTF-8") to get a utf-8 encoding of 
> the string as a byte array.
>
> On Thu, Jul 9, 2015 at 10:41 AM, > 
> wrote:
>
>>
>> > As for the escaped quotes, you may be using pr or prn to print, or 
>> maybe you are 
>> > using pr-str to produce the string representation. I can't be sure. 
>>
>> At the moment I create the string like this: 
>>
>> document-as-string (str "{\"transaction-id\" : \"" transaction-id 
>> "\", \"message\" : \"" message "\"}")
>> document-as-byte-array (bytes (byte-array (map (comp byte int) 
>> document-as-string)))
>>
>> The crazy thing is that this sometimes works, but other times the quote 
>> marks appear in Redis as escaped quote marks. As near as I can tell, the 
>> important factor is the length of the string. A short string is likely to 
>> have its quote marks escaped. A long string does not have its quote marks 
>> escaped. 
>>
>> My co-worker is working on the Java app. I am working on the Clojure app. 
>> We can both adjust out apps freely, just so long as we can get data to and 
>> from each other, in a manner that allows us to eventually cast the data to 
>> and from JSON. 
>>
>> Any suggestions are welcome. 
>>
>>
>>
>>
>>
>>
>> On Wednesday, July 8, 2015 at 8:58:53 PM UTC-4, Francis Avila wrote:
>>>
>>> Who is saving these strings, and who is reading them? Do you have 
>>> complete control over both apps, or does one of them need to be aligned 
>>> with the other?
>>>
>>> If the Java app is the baseline, you need to know the exact details of 
>>> the format of the data it saves. Just knowing "it's JSON" is not enough, 
>>> because there may be other data types (e.g. dates) that don't have native 
>>> JSON representations. (The go-to JSON de/encoder for clojure is cheshire: 
>>> https://github.com/dakrone/cheshire )
>>>
>>> I took a quick look at Jedis and the easy, default way of using it is 
>>> with strings. It will encode strings to UTF-8 before sending to Redis and 
>>> decode from UTF-8 on read. You can set raw byte arrays too (which will not 
>>> be altered in any way before sending), but it's not clear to me how it can 
>>> read out raw byte arrays. (I'm sure there's a way, but it's not immediately 
>>> obvious.)
>>>
>>> As for the escaped quotes, you may be using pr or prn to print, or maybe 
>>> you are using pr-str to produce the string representation. I can't be sure. 
>>>
>>> On Wednesday, July 8, 2015 at 5:31:27 PM UTC-5, gingers...@gmail.com 
>>> wrote:

 And I have another stupid question. Using the above code, I am 
 sometimes getting strings in Redis that have escaped quotation marks, like 
 this:

 " \"transaction-id\" : \" 1ec47c2e-21ee-427c-841c-80a0f89f55d7 \"  
 \"debrief\" :  \" Susan Hilly at Citi called to get a quotation for 
 discounted weekly car rental for approximately 3 cars per week, or 150 
 rentals annually. \"  "

 Why is that happening? 



 On Wednesday, July 8, 2015 at 5:38:20 PM UTC-4, gingers...@gmail.com 
 wrote:
>
> Francis Avila, 
>
> Thank you for your response. The Java app is using Jedis and the 
> Clojure app is using Carmine. I'm wondering if you can suggest what you 
> think would be the easiest way to allow these 2 apps to understand each 
> other's strings?
>
> You were correct about how unsafe the above code was. I tested it for 
> less than 15 minutes and ran into the fact that a \n newline made a mess 
> of 
> everything. 
>
>
>
> On Wednesday, July 8, 2015 at 5:15:35 PM UTC-4, Francis Avila wrote:
>>
>> You are running into Carmine's automatic nippy serialization. 
>> https://github.com/ptaoussanis/carmine#serialization
>>
>> Redis only stores byte arrays (what it calls "strings"). Carmine uses 
>> the nippy library (the meaning of "NPY" in your byte stream) to 
>> represent 
>> rich types compactly as bytes. https://github.com/ptaoussanis/nippy
>>
>> If you give Carmine a byte array to store, it will store it directly 
>> without nippy-encoding it. E.g. (.getBytes "{}" "UTF-8")
>>
>> BTW your document-as-string example is extremely unsafe: how will you 
>> reliably read this message out again? e.g. what if the 'debrief' string 
>> contains a single quote? Use a proper serialization for

Why do I need to include the namespace "clojure.core" in the REPL?

2015-07-09 Thread gingersafflower
If I launch "lein repl" I run into this problem: 

garlic.guide=>  (ns-publics 'garlic.guide)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
ns-publics in this context, 
compiling:(/tmp/form-init8901241567953840232.clj:1:1) 

I have to type out the namespace name "clojure.core": 

garlic.guide=>  (clojure.core/ns-publics 'garlic.query)
{walk-deep-structure #'garlic.query/walk-deep-structure, convert 
#'garlic.query/convert, fetch #'garlic.query/fetch, 
walk-deep-structure-for-values }

I am curious if there is a way to permanently include "clojure.core"? 


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


Re: Why do I need to include the namespace "clojure.core" in the REPL?

2015-07-09 Thread James Reeves
Your prompt indicates that the namespace you're in is "garlic.guide". My
guess is that you don't have an associated file with that namespace that
has an "ns" declaration.

- James

On 9 July 2015 at 23:21,  wrote:

> If I launch "lein repl" I run into this problem:
>
> garlic.guide=>  (ns-publics 'garlic.guide)
> CompilerException java.lang.RuntimeException: Unable to resolve symbol:
> ns-publics in this context,
> compiling:(/tmp/form-init8901241567953840232.clj:1:1)
>
> I have to type out the namespace name "clojure.core":
>
> garlic.guide=>  (clojure.core/ns-publics 'garlic.query)
> {walk-deep-structure #'garlic.query/walk-deep-structure, convert
> #'garlic.query/convert, fetch #'garlic.query/fetch,
> walk-deep-structure-for-values }
>
> I am curious if there is a way to permanently include "clojure.core"?
>
>
>  --
> 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.


Advice on introducing a Java dev to Clojure

2015-07-09 Thread Johanna Belanger
Hi :)

I've recently broached the subject of Clojure with another dev in my 
organization, and his response was basically "What's Clojure"? and I'm not 
sure how to answer that in a way that might inspire him. "It's a 
dynamically-typed functional Lisp with persistent immutable data structures 
that runs on the JVM" doesn't seem like it will grab his interest. =)

I work primarily in .NET, and he does enterprise Java. I don't know him 
well enough to know how happy he is with it. He did express interest in 
learning .Net.

 I came to an appreciation of Clojure through 

-CQRS (the power of decomplection!)
-Sussman and Abelson's SICP class at MIT online (the power of homoiconicity 
and functions!)
-the death of Silverlight (alternatives to Javascript in the browser?)

By the time I found Rich Hickey's talks (eg Simple Made Easy) I was pretty 
well primed to love Clojure. I've been using it for little personal 
projects and prototyping for a couple of years, but I haven't put it in 
production because no one else here knows it.

Could anyone tell me how they got from enterprise Java to Clojure?

Thanks very much,
Johanna

-- 
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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Ralf Schmitt
Johanna Belanger  writes:

> Could anyone tell me how they got from enterprise Java to Clojure?

Maybe the following links provide some useful information:

http://blog.juxt.pro/posts/selling-clojure.html
http://www.pitheringabout.com/?p=693
http://www.lispcast.com/convince-your-boss-to-use-clojure

-- 
Cheers
Ralf

-- 
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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Johanna Belanger
Thank you, Ralf!

On Thursday, July 9, 2015 at 3:28:14 PM UTC-7, Ralf Schmitt wrote:
>
> Johanna Belanger > writes: 
>
> > Could anyone tell me how they got from enterprise Java to Clojure? 
>
> Maybe the following links provide some useful information: 
>
> http://blog.juxt.pro/posts/selling-clojure.html 
> http://www.pitheringabout.com/?p=693 
> http://www.lispcast.com/convince-your-boss-to-use-clojure 
>
> -- 
> Cheers 
> Ralf 
>

-- 
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: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-09 Thread Francis Avila
This is what I am doing with Carmine and it seems to work properly.

First some setup in the repl:

user=>(require '[taoensso.carmine :as car])
nil
user=> (def conn {:pool {} :spec {}})
#'user/conn
user=> (defn raw-str-set [k ^String v] (car/set k (car/raw (.getBytes v 
"UTF-8"
#'user/raw-str-set
user=> (defn raw-str-get [k] (car/parse (car/get k) #(String. ^bytes % 
"UTF-8")))
#'user/raw-str-get


Now I save a test string:

user=> (car/wcar conn (raw-str-set "test" "a\"b"))
"OK"

In a redis-cli terminal:

$ redis-cli
127.0.0.1:6379> get "test"
"a\"b"
127.0.0.1:6379> 

The escaped \" you see in redis-cli is just for printing. The actual bytes 
stored at the "test" key are 0x61 0x22 0x62

Now lets pull this out of redis with Carmine:


user=> (car/wcar conn (raw-str-get "test"))
"a\"b"
user=> (count *1)
3

As you can see, we round-tripped without any strange extra escaping.

Probably your java app can just use Jedis client.get("test") and 
client.set("test","a-string"), since I think it does UTF-8 encode and 
decode of strings and no other serialization.


You still need to use JSON on top of this so you can get richer data 
structures instead of just strings.

On Thursday, July 9, 2015 at 4:18:51 PM UTC-5, gingers...@gmail.com wrote:
>
> I am sorry, I should have explained this sooner. When I do this: 
>
> (.getBytes document-as-string "UTF-8")
>
> The quote marks are always escaped. When I do this: 
>
> document-as-byte-array (bytes (byte-array (map (comp byte int) 
> document-as-string)))
>
> The quote marks are sometimes escaped, but most of the time they are not. 
>
> I need to avoid having those quote marks escaped. I am not clear what is 
> causing the escaping. 
>
>
>
>
> On Thursday, July 9, 2015 at 12:01:51 PM UTC-4, Francis Avila wrote:
>>
>> your document-as-byte-array is wrong--it only handles ascii, and very 
>> inefficiently too.
>>
>> Just say (.getBytes document-as-string "UTF-8") to get a utf-8 encoding 
>> of the string as a byte array.
>>
>> On Thu, Jul 9, 2015 at 10:41 AM,  wrote:
>>
>>>
>>> > As for the escaped quotes, you may be using pr or prn to print, or 
>>> maybe you are 
>>> > using pr-str to produce the string representation. I can't be sure. 
>>>
>>> At the moment I create the string like this: 
>>>
>>> document-as-string (str "{\"transaction-id\" : \"" 
>>> transaction-id "\", \"message\" : \"" message "\"}")
>>> document-as-byte-array (bytes (byte-array (map (comp byte int) 
>>> document-as-string)))
>>>
>>> The crazy thing is that this sometimes works, but other times the quote 
>>> marks appear in Redis as escaped quote marks. As near as I can tell, the 
>>> important factor is the length of the string. A short string is likely to 
>>> have its quote marks escaped. A long string does not have its quote marks 
>>> escaped. 
>>>
>>> My co-worker is working on the Java app. I am working on the Clojure 
>>> app. We can both adjust out apps freely, just so long as we can get data to 
>>> and from each other, in a manner that allows us to eventually cast the data 
>>> to and from JSON. 
>>>
>>> Any suggestions are welcome. 
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Wednesday, July 8, 2015 at 8:58:53 PM UTC-4, Francis Avila wrote:

 Who is saving these strings, and who is reading them? Do you have 
 complete control over both apps, or does one of them need to be aligned 
 with the other?

 If the Java app is the baseline, you need to know the exact details of 
 the format of the data it saves. Just knowing "it's JSON" is not enough, 
 because there may be other data types (e.g. dates) that don't have native 
 JSON representations. (The go-to JSON de/encoder for clojure is cheshire: 
 https://github.com/dakrone/cheshire )

 I took a quick look at Jedis and the easy, default way of using it is 
 with strings. It will encode strings to UTF-8 before sending to Redis and 
 decode from UTF-8 on read. You can set raw byte arrays too (which will not 
 be altered in any way before sending), but it's not clear to me how it can 
 read out raw byte arrays. (I'm sure there's a way, but it's not 
 immediately 
 obvious.)

 As for the escaped quotes, you may be using pr or prn to print, or 
 maybe you are using pr-str to produce the string representation. I can't 
 be 
 sure. 

 On Wednesday, July 8, 2015 at 5:31:27 PM UTC-5, gingers...@gmail.com 
 wrote:
>
> And I have another stupid question. Using the above code, I am 
> sometimes getting strings in Redis that have escaped quotation marks, 
> like 
> this:
>
> " \"transaction-id\" : \" 1ec47c2e-21ee-427c-841c-80a0f89f55d7 \"  
> \"debrief\" :  \" Susan Hilly at Citi called to get a quotation for 
> discounted weekly car rental for approximately 3 cars per week, or 150 
> rentals annually. \"  "
>
> Why is that happening? 
>
>
>
> On Wednesday, July 8, 2015 at 

Re: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Colin Yates
It's tricky, but I would ask them what pain points they experience with the
Java stack and go from there. I find the biggest barrier is the "yeah, what
I've got works fine"/complacency attitude. If they are perfectly happy
where they are then great, lesve them to it and go be 10 times more
productive ;).

I found clojure a breath of fresh air because it addressed pain I was
feeling. There was a cost, of course; everything is a compromise, but my
point is to truly "get" Clojure it has to offer you something you consider
valuable.

I will say for me, coming from a very deep entrenchment in Spring,
Hibernate etc that the biggest struggle I had was undoing years of learning
Java EE and all the support that brought with it. The idea of having to
think first? Shocker :). I often like to say that the design  pattern I use
the most now is "Hammock time" :).

There are two bookd you might want to give them, Functional Programing for
OO by Brian Marick and another one I can't remember the title of but
something like Functional Programming in Clojure and Scala. They might both
help provide an on-ramp.
On 9 Jul 2015 23:20, "Johanna Belanger"  wrote:

> Hi :)
>
> I've recently broached the subject of Clojure with another dev in my
> organization, and his response was basically "What's Clojure"? and I'm not
> sure how to answer that in a way that might inspire him. "It's a
> dynamically-typed functional Lisp with persistent immutable data structures
> that runs on the JVM" doesn't seem like it will grab his interest. =)
>
> I work primarily in .NET, and he does enterprise Java. I don't know him
> well enough to know how happy he is with it. He did express interest in
> learning .Net.
>
>  I came to an appreciation of Clojure through
>
> -CQRS (the power of decomplection!)
> -Sussman and Abelson's SICP class at MIT online (the power of
> homoiconicity and functions!)
> -the death of Silverlight (alternatives to Javascript in the browser?)
>
> By the time I found Rich Hickey's talks (eg Simple Made Easy) I was pretty
> well primed to love Clojure. I've been using it for little personal
> projects and prototyping for a couple of years, but I haven't put it in
> production because no one else here knows it.
>
> Could anyone tell me how they got from enterprise Java to Clojure?
>
> Thanks very much,
> Johanna
>
>  --
> 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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Sean Corfield
On Jul 9, 2015, at 5:22 PM, Colin Yates  wrote:
> There are two bookd you might want to give them, Functional Programing for OO 
> by Brian Marick and another one I can't remember the title of but something 
> like Functional Programming in Clojure and Scala. They might both help 
> provide an on-ramp.

https://pragprog.com/book/mbfpp/functional-programming-patterns-in-scala-and-clojure
 — Highly recommended!

Sean

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

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



-- 
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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Johanna Belanger
Thanks, Colin. That's really helpful. He seems very competent in the Java 
EE stack, too. In .Net, nothing ever stays the same long enough for me to 
get that comfortable. =\

One good thing is I don't actually need him to switch to Clojure, just to 
learn it well enough that he can understand my code in case of emergency. 
Because I'm feeling pain, and I need to be 10 times more productive. =)

On Thursday, July 9, 2015 at 5:22:17 PM UTC-7, Colin Yates wrote:
>
> It's tricky, but I would ask them what pain points they experience with 
> the Java stack and go from there. I find the biggest barrier is the "yeah, 
> what I've got works fine"/complacency attitude. If they are perfectly happy 
> where they are then great, lesve them to it and go be 10 times more 
> productive ;).
>
> I found clojure a breath of fresh air because it addressed pain I was 
> feeling. There was a cost, of course; everything is a compromise, but my 
> point is to truly "get" Clojure it has to offer you something you consider 
> valuable. 
>
> I will say for me, coming from a very deep entrenchment in Spring, 
> Hibernate etc that the biggest struggle I had was undoing years of learning 
> Java EE and all the support that brought with it. The idea of having to 
> think first? Shocker :). I often like to say that the design  pattern I use 
> the most now is "Hammock time" :).
>
> There are two bookd you might want to give them, Functional Programing for 
> OO by Brian Marick and another one I can't remember the title of but 
> something like Functional Programming in Clojure and Scala. They might both 
> help provide an on-ramp.
> On 9 Jul 2015 23:20, "Johanna Belanger"  > wrote:
>
>> Hi :)
>>
>> I've recently broached the subject of Clojure with another dev in my 
>> organization, and his response was basically "What's Clojure"? and I'm not 
>> sure how to answer that in a way that might inspire him. "It's a 
>> dynamically-typed functional Lisp with persistent immutable data structures 
>> that runs on the JVM" doesn't seem like it will grab his interest. =)
>>
>> I work primarily in .NET, and he does enterprise Java. I don't know him 
>> well enough to know how happy he is with it. He did express interest in 
>> learning .Net.
>>
>>  I came to an appreciation of Clojure through 
>>
>> -CQRS (the power of decomplection!)
>> -Sussman and Abelson's SICP class at MIT online (the power of 
>> homoiconicity and functions!)
>> -the death of Silverlight (alternatives to Javascript in the browser?)
>>
>> By the time I found Rich Hickey's talks (eg Simple Made Easy) I was 
>> pretty well primed to love Clojure. I've been using it for little personal 
>> projects and prototyping for a couple of years, but I haven't put it in 
>> production because no one else here knows it.
>>
>> Could anyone tell me how they got from enterprise Java to Clojure?
>>
>> Thanks very much,
>> Johanna
>>
>>  -- 
>> 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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Johanna Belanger
Thanks Sean =)

On Thursday, July 9, 2015 at 5:27:16 PM UTC-7, Sean Corfield wrote:
>
> On Jul 9, 2015, at 5:22 PM, Colin Yates > 
> wrote: 
> > There are two bookd you might want to give them, Functional Programing 
> for OO by Brian Marick and another one I can't remember the title of but 
> something like Functional Programming in Clojure and Scala. They might both 
> help provide an on-ramp. 
>
>
> https://pragprog.com/book/mbfpp/functional-programming-patterns-in-scala-and-clojure
>  
> — Highly recommended! 
>
> Sean 
>
> Sean Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>
>
>
>

-- 
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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Raoul Duke
> and I need to be 10 times more productive. =)

you mean, after your 2 week ramp-up time, right?

-- 
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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Johanna Belanger
Lol, that's an interesting reply. I'm suspecting it's a warning. Care to 
expand?

On Thursday, July 9, 2015 at 6:16:25 PM UTC-7, raould wrote:
>
> > and I need to be 10 times more productive. =) 
>
> you mean, after your 2 week ramp-up time, right? 
>

-- 
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: clj-rethinkdb 0.10.1

2015-07-09 Thread Daniel Compton
I'm pleased to announce the release of clj-rethinkdb
 version 0.10.1, an idiomatic
driver for RethinkDB . This release brings a number
of new features including:

* Explicit, tested support for RethinkDB 2.0, including changefeeds.
* Use an implicit database connection so you don't need to specify the
database for every query.
* New arities for table queries which no longer require a database to be
specified.
* General cleaning up in preparation for future work, e.g. fixing
reflection warnings, more descriptive error messages, better docstrings,
refactoring tests, e.t.c.

There is also a full CHANGELOG

with release notes on these features and more.

*Of particular note, the 0.10.x branch will be the last branch to support
Clojure 1.6 and below.* 0.11 and onwards will use Clojure 1.7 in order to
take advantage of reader conditionals and generating queries on the client.

There are two really neat features of RethinkDB:
1. It uses a functional composable query language built on s-expressions
which dovetails nicely with Clojure.
2. It supports real-time, streaming, change feeds for documents, tables,
and (some) arbitrary queries.

If you haven't looked at it before, I encourage you to check out the 30-second
quick start .

Thanks, Daniel.
-- 
--
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.


Re: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Johanna Belanger
I should say, because I'm worried this came across wrong, that I don't 
expect him, or anyone, to learn Clojure for my sake, but only if they find 
value in it. That's why I'm looking for a simple way to showcase the value.

On Thursday, July 9, 2015 at 5:54:51 PM UTC-7, Johanna Belanger wrote:
>
> Thanks, Colin. That's really helpful. He seems very competent in the Java 
> EE stack, too. In .Net, nothing ever stays the same long enough for me to 
> get that comfortable. =\
>
> One good thing is I don't actually need him to switch to Clojure, just to 
> learn it well enough that he can understand my code in case of emergency. 
> Because I'm feeling pain, and I need to be 10 times more productive. =)
>
> On Thursday, July 9, 2015 at 5:22:17 PM UTC-7, Colin Yates wrote:
>>
>> It's tricky, but I would ask them what pain points they experience with 
>> the Java stack and go from there. I find the biggest barrier is the "yeah, 
>> what I've got works fine"/complacency attitude. If they are perfectly happy 
>> where they are then great, lesve them to it and go be 10 times more 
>> productive ;).
>>
>> I found clojure a breath of fresh air because it addressed pain I was 
>> feeling. There was a cost, of course; everything is a compromise, but my 
>> point is to truly "get" Clojure it has to offer you something you consider 
>> valuable. 
>>
>> I will say for me, coming from a very deep entrenchment in Spring, 
>> Hibernate etc that the biggest struggle I had was undoing years of learning 
>> Java EE and all the support that brought with it. The idea of having to 
>> think first? Shocker :). I often like to say that the design  pattern I use 
>> the most now is "Hammock time" :).
>>
>> There are two bookd you might want to give them, Functional Programing 
>> for OO by Brian Marick and another one I can't remember the title of but 
>> something like Functional Programming in Clojure and Scala. They might both 
>> help provide an on-ramp.
>> On 9 Jul 2015 23:20, "Johanna Belanger"  wrote:
>>
>>> Hi :)
>>>
>>> I've recently broached the subject of Clojure with another dev in my 
>>> organization, and his response was basically "What's Clojure"? and I'm not 
>>> sure how to answer that in a way that might inspire him. "It's a 
>>> dynamically-typed functional Lisp with persistent immutable data structures 
>>> that runs on the JVM" doesn't seem like it will grab his interest. =)
>>>
>>> I work primarily in .NET, and he does enterprise Java. I don't know him 
>>> well enough to know how happy he is with it. He did express interest in 
>>> learning .Net.
>>>
>>>  I came to an appreciation of Clojure through 
>>>
>>> -CQRS (the power of decomplection!)
>>> -Sussman and Abelson's SICP class at MIT online (the power of 
>>> homoiconicity and functions!)
>>> -the death of Silverlight (alternatives to Javascript in the browser?)
>>>
>>> By the time I found Rich Hickey's talks (eg Simple Made Easy) I was 
>>> pretty well primed to love Clojure. I've been using it for little personal 
>>> projects and prototyping for a couple of years, but I haven't put it in 
>>> production because no one else here knows it.
>>>
>>> Could anyone tell me how they got from enterprise Java to Clojure?
>>>
>>> Thanks very much,
>>> Johanna
>>>
>>>  -- 
>>> 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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Sean Corfield
On Jul 9, 2015, at 7:58 PM, Johanna Belanger  wrote:
> I should say, because I'm worried this came across wrong, that I don't expect 
> him, or anyone, to learn Clojure for my sake, but only if they find value in 
> it. That's why I'm looking for a simple way to showcase the value.

One caution I will provide here is that Clojure is a radically different way of 
programming / thinking for an "Enterprise Java" developer. I touch on that here:

http://seancorfield.github.io/blog/2014/09/23/clojure-in-the-enterprise/

(referenced in the LispCast article that Ralf linked to earlier)

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

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



-- 
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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Michael McLellan
That brings up an interesting point - what's the ramp-up time usually like 
for the Java devs that convert to Clojure?

On Thursday, July 9, 2015 at 9:16:25 PM UTC-4, raould wrote:
>
> > and I need to be 10 times more productive. =) 
>
> you mean, after your 2 week ramp-up time, right? 
>

-- 
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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Johanna Belanger
That's a good read, Sean. 

I'm a dedicated departmental programmer, and to be effective in my 
position, I need to be quick and nimble. For some of the problems I'm 
solving, my tools are causing an unsupportable amount of drag. Clojure 
would be a brilliant match. But because I'm a one-person team, the truck 
number makes it so risky to choose an unconventional technology.

Sharing Clojure with other developers is an attempt to balance those 
forces. I hesitated for a long time, but I finally decided it didn't hurt 
to try.

At this point, I'm not thinking of using Clojure for all of my coding, but 
only a few particular cases.

Thoughts?

On Thursday, July 9, 2015 at 8:04:11 PM UTC-7, Sean Corfield wrote:
>
> On Jul 9, 2015, at 7:58 PM, Johanna Belanger  > wrote: 
> > I should say, because I'm worried this came across wrong, that I don't 
> expect him, or anyone, to learn Clojure for my sake, but only if they find 
> value in it. That's why I'm looking for a simple way to showcase the value. 
>
> One caution I will provide here is that Clojure is a radically different 
> way of programming / thinking for an "Enterprise Java" developer. I touch 
> on that here: 
>
> http://seancorfield.github.io/blog/2014/09/23/clojure-in-the-enterprise/ 
>
> (referenced in the LispCast article that Ralf linked to earlier) 
>
> Sean Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>
>
>
>

-- 
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: Advice on introducing a Java dev to Clojure

2015-07-09 Thread Erik Assum
If you're a one-person team, don't be too worried. Your Clojure code will 
likely not be too big, so it will be fairly easy to understand and possibly 
rewrite to Java, if the truck thing was to happen. 

Erik. 
-- 
i farta

> Den 10. jul. 2015 kl. 07.25 skrev Johanna Belanger 
> :
> 
> That's a good read, Sean. 
> 
> I'm a dedicated departmental programmer, and to be effective in my position, 
> I need to be quick and nimble. For some of the problems I'm solving, my tools 
> are causing an unsupportable amount of drag. Clojure would be a brilliant 
> match. But because I'm a one-person team, the truck number makes it so risky 
> to choose an unconventional technology.
> 
> Sharing Clojure with other developers is an attempt to balance those forces. 
> I hesitated for a long time, but I finally decided it didn't hurt to try.
> 
> At this point, I'm not thinking of using Clojure for all of my coding, but 
> only a few particular cases.
> 
> Thoughts?
> 
>> On Thursday, July 9, 2015 at 8:04:11 PM UTC-7, Sean Corfield wrote:
>> On Jul 9, 2015, at 7:58 PM, Johanna Belanger  wrote: 
>> > I should say, because I'm worried this came across wrong, that I don't 
>> > expect him, or anyone, to learn Clojure for my sake, but only if they find 
>> > value in it. That's why I'm looking for a simple way to showcase the 
>> > value. 
>> 
>> One caution I will provide here is that Clojure is a radically different way 
>> of programming / thinking for an "Enterprise Java" developer. I touch on 
>> that here: 
>> 
>> http://seancorfield.github.io/blog/2014/09/23/clojure-in-the-enterprise/ 
>> 
>> (referenced in the LispCast article that Ralf linked to earlier) 
>> 
>> Sean Corfield -- (904) 302-SEAN 
>> An Architect's View -- http://corfield.org/ 
>> 
>> "Perfection is the enemy of the good." 
>> -- Gustave Flaubert, French realist novelist (1821-1880)
> 
> -- 
> 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.