Re: clojure.data.csv/write-csv isn't thread safe (should it be?)

2019-05-02 Thread matt . t . grimm
Well, snark and sarcasm aside, you've made me realize I was way too focused 
on making write-csv do what I wanted rather than come up with a better 
solution. So thanks for that, but do try to keep up the impression that 
this is a friendly, welcoming community.

On Thursday, May 2, 2019 at 6:07:53 PM UTC-6, Matching Socks wrote:
>
> Wow, that user.clj is impressive.  This is a top-notch application of 
> clojure core async!  Nonetheless, if one is going to the trouble of making 
> 100 threads, it would be clearer and farther-sighted (and not much more 
> work) to toss the results into a channel that a single thread drained into 
> an output file.  In that sense, a "fix" of the csv writer would not even be 
> in our best interest.  Moreover, isn't the default expectation that 
> multi-threaded side effects will inevitably produce a mud puddle?  If "this 
> is not thread-safe, of course" were added to one side-effecting function's 
> docstring, would the interests of fairness demand such a flag on many more 
> functions?!  Since most Clojure programs are not AOT-compiled, the extra 
> bloat of docstrings would make program startup take longer.  The delay 
> could be mitigated somewhat by Huffman-encoding the docstrings.
>

-- 
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.data.csv/write-csv isn't thread safe (should it be?)

2019-05-02 Thread Michael Gardner
Note that clojure.core/println is also not "thread-safe" in that sense: two 
threads doing `(println "foo" "bar")` may produce interleaved output.

> On May 2, 2019, at 05:59, matt.t.gr...@gmail.com wrote:
> 
> The write-csv function in clojure.data.csv isn't thread safe because even 
> though it uses the synchronized .write method on BufferedReader, it does so 
> at the cell level, not the row/line level. Is this expected or a bug? Is 
> there a reason it shouldn't be made thread safe?
> 
> Attached is a simple test showing the result of calling write-csv with a 
> single thread vs. 100 threads. With a single thread, the output is correct, 
> and with 100 threads the result is a jumbled mess. Conversely, if I use 
> clojure-csv and manually write at the row level using the same harness, it 
> works as expected with multiple threads.
> 
> -- 
> 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: clojure.data.csv/write-csv isn't thread safe (should it be?)

2019-05-02 Thread Matching Socks
Wow, that user.clj is impressive.  This is a top-notch application of 
clojure core async!  Nonetheless, if one is going to the trouble of making 
100 threads, it would be clearer and farther-sighted (and not much more 
work) to toss the results into a channel that a single thread drained into 
an output file.  In that sense, a "fix" of the csv writer would not even be 
in our best interest.  Moreover, isn't the default expectation that 
multi-threaded side effects will inevitably produce a mud puddle?  If "this 
is not thread-safe, of course" were added to one side-effecting function's 
docstring, would the interests of fairness demand such a flag on many more 
functions?!  Since most Clojure programs are not AOT-compiled, the extra 
bloat of docstrings would make program startup take longer.  The delay 
could be mitigated somewhat by Huffman-encoding the docstrings.

-- 
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: Noob: Getting (re)started with Clojure on OS X

2019-05-02 Thread marcpiresrj
Had the same issue and solved updating cider-nrepl to 0.21.1 in my profile

Em quinta-feira, 14 de março de 2019 13:43:56 UTC-3, Sean Corfield escreveu:
>
> With modern versions of CIDER, those dependencies are injected 
> automatically (and with the correct version).
>
>  
>
> I would advise keeping as little as possible in your profiles.clj file – 
> it’s possibly the number one cause of problems for Leiningen users because 
> people forget they have some plugin or dependency in there and months later 
> it conflicts with some new project they’re working on in weird ways.
>
>  
>
> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>  
> --
> *From:* clo...@googlegroups.com   > on behalf of Kenneth Beesley  >
> *Sent:* Wednesday, March 13, 2019 10:54:19 AM
> *To:* clo...@googlegroups.com 
> *Subject:* Re: Noob: Getting (re)started with Clojure on OS X 
>  
>
>
> On 13Mar2019, at 10:19, Sean Corfield > 
> wrote:
>
> Check what’s in your ~/.lein/profiles.clj file – that’s usually the cause 
> of bizarre errors that people report with Leiningen.
>
>
> Hello Sean,
>
> Hah!  I changed my ~/.lein/profiles.clj from
>
> {:user {:plugins [[cider/cider-nrepl "0.8.2"]]}}
>
> to
>
> {:user {:plugins [[lein-pprint "1.1.1"]]
> :dependencies [[slamhound "1.3.1"]]}}
>
> and now ‘lein repl’ launches. 
>
> Anything else I should add to ~/.lein/profiles.clj ?
>
> Many thanks!
>
> Ken
>
> ***
> Kenneth R. Beesley, D.Phil.
> PO Box 540475
> North Salt Lake UT 84054
> USA
>
>
>
>
>
>
> -- 
> 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
> clo...@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 clo...@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: clojure.data.csv/write-csv isn't thread safe (should it be?)

2019-05-02 Thread Alex Miller
I think the vast majority of the time, people are writing a csv file in a 
single thread. Issue/patch welcome though...

On Thursday, May 2, 2019 at 7:59:05 AM UTC-5, matt@gmail.com wrote:
>
> The write-csv function in clojure.data.csv isn't thread safe because even 
> though it uses the synchronized .write method on BufferedReader, it does so 
> at 
> the cell level 
> ,
>  
> not the row/line level. Is this expected or a bug? Is there a reason it 
> shouldn't be made thread safe?
>
> Attached is a simple test showing the result of calling write-csv with a 
> single thread vs. 100 threads. With a single thread, the output is correct, 
> and with 100 threads the result is a jumbled mess. Conversely, if I use 
> clojure-csv  and manually 
> write at the row level using the same harness, it works as expected with 
> multiple threads.
>

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


clojure.data.csv/write-csv isn't thread safe (should it be?)

2019-05-02 Thread matt . t . grimm
The write-csv function in clojure.data.csv isn't thread safe because even 
though it uses the synchronized .write method on BufferedReader, it does so at 
the cell level 
,
 
not the row/line level. Is this expected or a bug? Is there a reason it 
shouldn't be made thread safe?

Attached is a simple test showing the result of calling write-csv with a 
single thread vs. 100 threads. With a single thread, the output is correct, 
and with 100 threads the result is a jumbled mess. Conversely, if I use 
clojure-csv  and manually 
write at the row level using the same harness, it works as expected with 
multiple threads.

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


user.clj
Description: Binary data