Re: Efficient idioms to handle large lists?

2013-02-01 Thread Takahiro Hozumi
Hi Bruce, Try `into` instead of `concat`. Applying concat to growing data is like Schlemiel the Painter's algorithm. Cheers. On 2月1日, 午後4:19, bruce li leilmy...@gmail.com wrote: Hello, everyone. I'm experience some performance issue when using clojure. The scenario is as follows: I have a

Re: (into [] (take n v)) vs (subvec v 0 n)

2013-02-01 Thread Marko Topolnik
Also make sure to keep in mind that subvecs are *second class* objects and are not equivalent to regular vectors in terms of API. See for example this issue. http://dev.clojure.org/jira/browse/CLJ-1082 I wouldn't worry too much about subvectors. Unless you identify them as a bottleneck

Re: Efficient idioms to handle large lists?

2013-02-01 Thread Marko Topolnik
Definitely don't recursively apply concat, it will end up with a stack overflow due the way the laziness of concat is implemented. First and foremost, are you absolutely sure you need the full list realized in memory? Your first approach with *mapcat* could be the best option if you can make

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread Alan Malloy
(max-key :power mario luigi) On Thursday, January 31, 2013 6:08:21 PM UTC-8, Leandro Moreira wrote: Running through this problem I also faced the weird situation, so: Given two maps (def mario {:color red :power 45}) (def luigi {:color green :power 40}) I want the max between both but

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread AtKaaZ
amalloy, inspirational as always! thank you On Fri, Feb 1, 2013 at 11:08 AM, Alan Malloy a...@malloys.org wrote: (max-key :power mario luigi) On Thursday, January 31, 2013 6:08:21 PM UTC-8, Leandro Moreira wrote: Running through this problem I also faced the weird situation, so: Given

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread Leandro Moreira
thanks On Friday, February 1, 2013 8:08:20 AM UTC-2, Alan Malloy wrote: (max-key :power mario luigi) On Thursday, January 31, 2013 6:08:21 PM UTC-8, Leandro Moreira wrote: Running through this problem I also faced the weird situation, so: Given two maps (def mario {:color red :power 45})

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread Leandro Moreira
thanks mand On Friday, February 1, 2013 12:41:44 AM UTC-2, Zack Maril wrote: Take a look at this gist: https://gist.github.com/4688693 It uses memoize to eek out a little bit more performance. λ ~/Projects/experiments/collatz lein run Compiling collatz.core [9 19] Elapsed time: 30.236

Re: Hooking into doc and source

2013-02-01 Thread Phillip Lord
Brian Marick mar...@exampler.com writes: On Jan 31, 2013, at 5:50 AM, Phillip Lord phillip.l...@newcastle.ac.uk wrote: So, I really would like to hook into the doc function so that I can return a documentation string pulled directly from the underlying Java object; I already have a function

Re: Hooking into doc and source

2013-02-01 Thread Phillip Lord
Hugo Duncan duncan.h...@gmail.com writes: phillip.l...@newcastle.ac.uk (Phillip Lord) writes: I'm build a library which provides a DSL for building ontologies. Underneath this backs onto a Java API. The library works by provide some macros, which create Java objects then intern them into the

How to read a txt file?

2013-02-01 Thread Roger75
I'd like to read a txt file using clojure. How do I do that? Any examples? -- -- 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

Re: How to read a txt file?

2013-02-01 Thread Baishampayan Ghose
clojure.core/slurp Sent from phone. Please excuse brevity. On 1 Feb 2013 18:13, Roger75 rcana...@gmail.com wrote: I'd like to read a txt file using clojure. How do I do that? Any examples? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: How to read a txt file?

2013-02-01 Thread AtKaaZ
there are some examples here: http://clojuredocs.org/clojure_core/clojure.core/slurp http://clojuredocs.org/clojure_core/clojure.java.io/reader On Fri, Feb 1, 2013 at 1:44 PM, Baishampayan Ghose b.gh...@gmail.comwrote: clojure.core/slurp Sent from phone. Please excuse brevity. On 1 Feb

Re: How to read a txt file?

2013-02-01 Thread Zack Maril
Look at slurp. http://clojuredocs.org/clojure_core/1.2.0/clojure.core/slurp On Friday, February 1, 2013 4:17:43 PM UTC+4, Roger75 wrote: I'd like to read a txt file using clojure. How do I do that? Any examples? -- -- You received this message because you are subscribed to the Google Groups

Re: *read-eval* vulnerability

2013-02-01 Thread Chas Emerick
On Jan 31, 2013, at 8:03 PM, Chas Emerick wrote: On Jan 30, 2013, at 5:59 PM, Michał Marczyk wrote: On 30 January 2013 23:32, Chas Emerick c...@cemerick.com wrote: On Jan 30, 2013, at 12:23 PM, Michael Fogus wrote: RuntimeException EvalReader not allowed when *read-eval* is false.

Re: How to read a txt file?

2013-02-01 Thread Roger75
Hi, I'm trying to use this console: http://tryclj.com/ the command I wrote: (slurp C:\\Users\\User1\\teste\\teste.txt) I get this: java.lang.RuntimeException: Unable to resolve symbol: in this context On Friday, February 1, 2013 10:17:43 AM UTC-2, Roger75 wrote: I'd like to read a txt file

Re: How to read a txt file?

2013-02-01 Thread Andy Fingerhut
Roger, tryclj.com is limited in what it can do. The Clojure code you type in there is running on the web server across the network from you, not on your own local machine. That file isn't accessible there. Also for that reason many symbols are not allowed to be used in tryclj.com

Re: How to read a txt file?

2013-02-01 Thread greg r
slurp works well, however, it reads the file in as a single string. The result may not be readily useable depending on what you are doing. I read in text files using clojure.java.io functions plus the core function line-seq. What you get is a sequence whose elements are the individual lines

Re: *read-eval* vulnerability

2013-02-01 Thread Chas Emerick
I have added a patch to CLJ-1153 that appears to address the *read-eval* problem: http://dev.clojure.org/jira/browse/CLJ-1153?focusedCommentId=30523#comment-30523 code on github: https://github.com/cemerick/clojure/commit/1f5c19c07443d2535ede4ff71d23b40c195d617f artifact on Clojars:

ANN: babbage 1.0.0, a library for easily gathering data and computing summary measures in a declarative way

2013-02-01 Thread Ben Wolfson
ReadyForZero is open-sourcing our library for easily gathering data and computing summary measures in a declarative way: https://github.com/ReadyForZero/babbage The summary measure functionality allows you to compute multiple measures over arbitrary partitions of your input data simultaneously

Re: emacs - how to wean me off the family of Java IDEs

2013-02-01 Thread Korny Sietsma
Phillip - thanks, that works nicely. (I had gotten it working by downloading sr-speedbar.el manually and editing it, but I prefer to stick with the packaged version if possible, less for me to remember) - Korny On 25 January 2013 00:38, Phillip Lord phillip.l...@newcastle.ac.uk wrote:

Re: emacs - how to wean me off the family of Java IDEs

2013-02-01 Thread Korny Sietsma
Actually, that still didn't seem to work. After a bit of fiddling, I found that if I install sr-speedbar from melpa, it spits out a couple of warnings, thinks it is installed, but I don't get any sr-speedbar commands. Strange. I'll stick to just downloading the package from

Re: *read-eval* vulnerability

2013-02-01 Thread Baishampayan Ghose
Just did some testing with our code-base and Clojure 1.5.0-RC4 (with and without Chas' read-eval patch). There is definitely something strange going on. Things worked just fine with 1.5.0-RC4 but with the read-eval patch `lein swank` is completely broken but more than that, our code is failing to

Re: emacs - how to wean me off the family of Java IDEs

2013-02-01 Thread John Chijioke
+1 for ECB. Especially alexott's work. I have been using ecb for over a year now and I can assure you it's totally awesome. Nothing beats it in emacs when it comes to exploring source code directory structure. you need it. With eshell integrated to switch automatically to your working

Re: ANN: babbage 1.0.0, a library for easily gathering data and computing summary measures in a declarative way

2013-02-01 Thread AtKaaZ
seems a bit similar to https://github.com/Prismatic/plumbing On Sat, Feb 2, 2013 at 1:12 AM, Ben Wolfson wolf...@gmail.com wrote: ReadyForZero is open-sourcing our library for easily gathering data and computing summary measures in a declarative way: https://github.com/ReadyForZero/babbage