Re: Spread work onto multiple threads (in pure Clojure)

2011-10-12 Thread Avram
I haven't read the entire thread carefully, but have you considered the "work" library as a potential fit for what you are trying to do? Example from the github link: user> (require '[work.core :as work]) user> (work/map-work client/get ["http://clojure.org"; "h

Re: Why can't I print new sequence?

2011-08-26 Thread Avram Aelony
Any reason not to use a Set ? On Wed, Aug 24, 2011 at 3:57 PM, Ken Wesson wrote: > On Wed, Aug 24, 2011 at 5:58 PM, octopusgrabbus > wrote: >> (defn f1 >>     [in-seq] >>     (loop [new-seq [] cur-seq in-seq] >>     (if (nil? (first cur-seq)) >>     new-seq >>     (if-not (n

Re: library or namespace doc helper function from repl?

2011-06-02 Thread Avram
. etc… (ns-publics 'lib) works best for me. -A On Jun 2, 10:22 am, James Estes wrote: > You could also try > (find-doc "libname") > > On Thu, Jun 2, 2011 at 11:15 AM, Alex Robbins > > > > wrote: > > (ns-publics 'namespace) will show all the public

Re: library or namespace doc helper function from repl?

2011-06-02 Thread Avram
That's perfect. Thank-you! -A On Jun 2, 10:15 am, Alex Robbins wrote: > (ns-publics 'namespace) will show all the publicly defined things in a > namespace. > > > > On Thu, Jun 2, 2011 at 11:51 AM, Avram wrote: > > > Apologies for a silly question, there mus

library or namespace doc helper function from repl?

2011-06-02 Thread Avram
t yet know the name. I realize that I can try to use the Atlas url (which is awesome) or an IDE or check github, but it would be really nice not to have to leave the repl. In R I would do: library(help=libname) Thanks in advance, Avram -- You received this message because you are subscribed to

Re: Lazily read XML larger than memory: my take at parser API

2011-05-31 Thread Avram
Interestingly, I had planned on using Jackson, but found that because my JSON data in fact was not always well-formed and needed minor cleaning steps (e.g. double newline without interleave commas between JSON chunks), I needed to create better chunks of well-formed JSON first in a streaming sort o

Re: Lazily read XML larger than memory: my take at parser API

2011-05-31 Thread Avram
chunks and then parsing the JSON on the chunk. In this way, I can scale better because these files are quite large, and I can leverage hadoop or cascalog eventually. Has anyone attempted anything similar to achieve the "chunking"? Thanks, Avram On May 31, 1:33 pm, Ilya Kasnacheev wrote

Re: call to idiomatic loop works as stand alone but not when wrapped in my function

2011-04-15 Thread Avram
This makes perfect sense. I reached for this strategy initially but got lost along the way trying to consider how to enable N inputs via a -main function. I'm all set now. Many thanks, Avram On Apr 15, 11:11 am, Alan wrote: > You never "need" & when you are defining yo

Re: call to idiomatic loop works as stand alone but not when wrapped in my function

2011-04-15 Thread Avram
but difficult to search for things like args or % or & to find answers ;) Best, Avram On Apr 15, 1:10 am, Alan wrote: > I would do it by making read-files-into-memory take a single argument, > a list of filenames, rather than N arguments, each of which is a > filename. Just d

Re: call to idiomatic loop works as stand alone but not when wrapped in my function

2011-04-14 Thread Avram
-memory [ & filenames ] (print filenames) (map #(read-json-filename %1) filenames)) Many thanks, Avram -- 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 ne

call to idiomatic loop works as stand alone but not when wrapped in my function

2011-04-14 Thread Avram
ctor" for the underlying call. Here are the details: ;; paths to 2 little testing files proj=> fnames ["/home/avram/devel/scratch/a.json" "/home/avram/devel/scratch/ b.json"] ;; function that can read one file proj=> (defn read-json-filename [ filename ] (cl

Re: from string to keyword?

2011-03-30 Thread Avram
Perfect. Thanks again. -A On Mar 30, 3:17 pm, Meikel Brandmeyer wrote: > Hi, > > Am 31.03.2011 um 00:02 schrieb Avram: > > > user=> (defn metric-diff [metric & json-objs] > >    (apply - (map (comp (Integer/parseInt :value) (keyword metric)) > > json-objs

Re: from string to keyword?

2011-03-30 Thread Avram
to java.lang.String (NO_SOURCE_FILE:0) How can I coerce the JSON stringified numbers into integers ? -Avram -- 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 n

Re: from string to keyword?

2011-03-30 Thread Avram
Many thanks! On Mar 30, 12:11 pm, Alan wrote: > (keyword "abcdef") => :abcdef > > (defn metric-diff [metric & json-objs] >   (apply - (map (comp :value (keyword metric)) json-objs))) > > Probably does what you want. > > On Mar 30, 12:04 pm, Avram wrote:

from string to keyword?

2011-03-30 Thread Avram
nsupported binding form: :metric (NO_SOURCE_FILE: 58) ;; I want to be able to call it like so (compute-metric-diff report1 report2 "abcdef" ) Any help appreciated. Many thanks, Avram -- You received this message because you are subscribed to the Google Groups "Clojure" grou

Re: beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Avram
Thanks, Stuart. > With Leiningen, you can add the :jvm-opts option in project.clj, Cool, this is what I was looking for :) >     (def signals (vec ...)) > > says that you want the entire result, as a vector, stored as the value of > the Var `signals`.  That means your entire result data must fi

Re: beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Avram
Thanks, Ken. > You'll need to avoid holding onto the head of your line-seq, which > means you'll need to make multiple passes over the data, one for the > as, one for the bs, and etc., with the output a lazy seq of lazy seqs. Actually, it would be great to make separate, asynchronous passes for t

beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Avram
low, which works for small input but not for the intended file sizes (and larger) I'd like it to be able to handle. (use 'clojure.contrib.io) (require 'clojure.string) (def tabfn "/Users/avram/data/testdata.tab") (defn is-comment? "Checks if argument is a comment

Re: ANN: Clojure Toolbox (Early Beta)

2011-02-25 Thread Avram
> Sure, you just need to point me toward machine learning projects > written in Clojure. Take a look at infer: https://github.com/getwoven/infer -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Re: Fastest way to generate comma-separated list

2010-10-27 Thread Avram
Does this help? user> (use 'clojure.string) nil user> (join "," (range 10)) "0,1,2,3,4,5,6,7,8,9" -Avram On Oct 28, 4:22 am, andrei wrote: > I was seeking `interpose` function, thanks. But it still doesn't work > for strings - they are not wrapp

Re: re-formulating sql statements

2010-10-05 Thread Avram
o it occurred to me that my (split) doesn't handle the commas you > have, so the regex should probably be something more like #"[ ,]+" okay, thanks :) > > On Oct 5, 2:49 pm, Avram wrote: > > > > > Alan, thanks for your response, I'm still new at this.  Running

Re: re-formulating sql statements

2010-10-05 Thread Avram
;m digging around for it… i suppose it is in the regex? (use 'clojure.java.io) (require 'clojure.string) ;;(refer 'clojure.string :only [split]) (refer 'clojure.string :only '(split) ) (let [pattern #"case when (\\S+) in \\(([^)]+)\\) then (\\S+) as (\\S +)"] (with

re-formulating sql statements

2010-10-05 Thread Avram
and output a corrected Hive-ready sql file. A complicating factor is that since there are single-quotes embedded in each line of the "in" clause statements, they likely need to be escaped a priori somehow. Any thoughts, comments, solutions, or advice on how to tackle this with clojure much

Re: Feedback on Clojure web development post

2010-07-29 Thread Avram
or editing and launching code for Apache Hive, Pig, or Cascalog seems within reach with this kind of set up ? Regards, ~Avram On Jul 24, 12:30 am, Mark McGranaghan wrote: > Hi All, > > I recently posted to my blog on the process of developing and > deploying a simple Clojure

Re: ClojureDocs.org

2010-07-16 Thread Avram
A few thoughts... It might be interesting to allow examples to be rated. Quality or usefulness of the provided example could then be inferred from the rating and highly rated examples could bubble to the top or have the associated rating prominently shown. ~A On Jul 16, 10:29 am, Lee Hinman wro

Re: DataLog

2010-07-13 Thread Avram
I am new to clojure but learning quickly. I haven't yet tried clojure.contrib.Datalog, but I analyze big data and I can say that I quite like Nathan Marz's Cascalog. Cascalog is reminiscent of datalog syntax but executes queries on Hadoop via Cascading for data that is too big to fit in memory.

Re: Clojure's n00b attraction problem

2010-06-30 Thread Avram
> Javascript is a nice thought too. I haven't tried it but there is a library for generating javascript from clojure forms... http://github.com/arohner/scriptjure#readme -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

Re: Clojure's n00b attraction problem

2010-06-29 Thread Avram
s the rest. I think letting Leiningen solve installation problems is a good way to go. Even for newbies. Go Leiningen!! ~Avram On Jun 28, 12:58 pm, cageface wrote: > On Jun 28, 12:25 pm, Daniel Gagnon wrote: > > > I believe that the success of ruby is due in great part to *Why&#