Where is the rotations function?

2014-02-10 Thread Mars0i
At one time there was a function named "rotations" in clojure.contrib.seq, and at another time in clojure.contrib.seq-utils . Neither of these libraries seem to be present as of Clojure 1.5, and I am not finding rotations anywhere else. Does rotations exist? I can write it myself, but don't

Re: How would I write it with concurrency

2014-02-10 Thread Haim Ashkenazi
Hi Gary Your idea about applying concurrency in the generation function seems to be an interesting solution. I'll try it. I'll also take a look at reducers (which I meant to do a long time ago :) ). Thanks a lot. /haim On Mon, Feb 10, 2014 at 11:28 PM, Gary Trakhman wrote: > (apply concat (se

lein-dynalint 0.1.4

2014-02-10 Thread Ambrose Bonnaire-Sergeant
Hi, lein-dynalint 0.1.4 is a little more robust. It now outputs results under target/dynalint-output, and always outputs results even when tests fail (writing the output is now in a try/finally). There is a nicer error message when the dynalint dependency is missing. README

Re: a couple questions about counting frequencies of words in a text file

2014-02-10 Thread john walker
Neat blog by the way. On Monday, February 10, 2014 8:41:51 PM UTC-5, Rob Buhler wrote: > > Hi, > > I'm learning Clojure and I wrote a word-frequencies function that relies > heavily on clojure.core/frequencies (plus a little filtering) > > (ns topwords.core > (require [clojure.java.io :as io] >

Re: a couple questions about counting frequencies of words in a text file

2014-02-10 Thread john walker
Well, I took a peek at the source for frequencies. It definitely forces evaluation, since it's done in terms of reduce. I don't think that it actually keeps the entire file in memory. Are you getting out of memory errors with large files? I like how you did this. Actually, the python you sugge

a couple questions about counting frequencies of words in a text file

2014-02-10 Thread Rob Buhler
Hi, I'm learning Clojure and I wrote a word-frequencies function that relies heavily on clojure.core/frequencies (plus a little filtering) (ns topwords.core (require [clojure.java.io :as io] [clojure.string :as str])) (def stop-words #{"other" "still" "again" "where" "could" "there"

Re: Question about best pattern for side-effecting function with a return value

2014-02-10 Thread Jarrod Swart
Awesome, thanks again! On Monday, February 10, 2014 9:35:32 PM UTC-5, Shaun Parker wrote: > > Hey Jarrod, > > You're welcome! I'm glad to hear that's helpful. As far as using map or > doseq; I'd use map if you want to use the results for further processing, > if not, I'd use doseq. This is a gue

Re: Question about best pattern for side-effecting function with a return value

2014-02-10 Thread Shaun Parker
Hey Jarrod, You're welcome! I'm glad to hear that's helpful. As far as using map or doseq; I'd use map if you want to use the results for further processing, if not, I'd use doseq. This is a guess, but it seems like you don't have any need for the results, you just want the side effects of upda

Re: Question about best pattern for side-effecting function with a return value

2014-02-10 Thread Jarrod Swart
Shaun, Thanks a lot for your response. This is a much nicer version of what I came up with. I have one question remaining: would you (map) over a seq of db-entities or would you use something else (doseq, for, etc). I typically use map/filter/reduce 99% of the time and I'm just wander if (

Re: Question about best pattern for side-effecting function with a return value

2014-02-10 Thread Shaun Parker
Hey Jarrod, Whenever I find myself writing out steps, like you just did, I like to use a method described by Stuart Sierra, pipelines. In your case, I'd write something like this: (defn make-api-call! [{:keys [db-entity] :as state}] (

Re: [ANN] lein-modules 0.1.0 - multi-module support in Leiningen

2014-02-10 Thread Jim Crossley
I didn't communicate this as well as I would've liked, probably due to overloaded terminology. The contrived example multi-module "project" would generate 3 artifacts. And the source code for those artifacts would be contained within 3 Leiningen "projects", which I refer to as "modules" to avoi

Re: [ANN] lein-modules 0.1.0 - multi-module support in Leiningen

2014-02-10 Thread Jim Crossley
I've not used lein-voom, but from a brief glance at its README, it seems to be an attempt at solving "the SNAPSHOT problem", i.e. the nightmare of multiple interdependent projects living in different git repos all under active development by multiple collaborators. The scope of lein-modules is sma

Question about best pattern for side-effecting function with a return value

2014-02-10 Thread Jarrod Swart
I'm having a hard time coming up with a satisfactory way to implement the following: 1. Call an API with a map from the DB containing various endpoint data like URL, etc. 2. If the response has an HTTP 200, update the map-from-db and then write response body to a file. 3. If ste

Re: How would I write it with concurrency

2014-02-10 Thread Gary Trakhman
Reducers might be a good fit if you want to parallelize a concat. http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html On Mon, Feb 10, 2014 at 4:28 PM, Gary Trakhman wrote: > (apply concat (session))? > > or consider mapcat.. > > if the thing behind ses

Re: [Kind of off-topic] Enlightenment

2014-02-10 Thread Kevin Ilchmann Jørgensen
Maybe only tangentially relevant. But way back in another time, i enjoyed the stories Kenny Tilton collected for the Road to Lisp Survey. /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

Re: How would I write it with concurrency

2014-02-10 Thread Gary Trakhman
(apply concat (session))? or consider mapcat.. if the thing behind session needs to be concurrent, it needs to be concurrent at that point, not in the code that calls it. There's no way to generally make it concurrent from above unless you know more about what's happening below. On Mon, Feb 10

Re: How would I write it with concurrency

2014-02-10 Thread Haim Ashkenazi
Hi JIm, The reason I don't use repeatedly is because (unless I'm mistaken) I would get a list of 5 outputs of session (file lists of between one and 5 elements each). I am interesting in taking the elements returned from session and concat it to what was already generated. Regarding concurrency,

Re: How would I write it with concurrency

2014-02-10 Thread Haim Ashkenazi
Thanks Aaron, simple-check is actually on my (very long) list of things to learn, but generating the data myself was pretty easy and a nice exercise. /haim On Mon, Feb 10, 2014 at 9:31 PM, Aaron France wrote: > Hi, > > Ignoring your question for a second to recommend using simple-check[0] > to

Re: [ANN] lein-modules 0.1.0 - multi-module support in Leiningen

2014-02-10 Thread dgrnbrg
Could you compare lein-modules with lein-voom? I can see that they have different features, but I'm trying get a handle on when each might be appropriate. This looks like a great tool for large projects. Thank you! On Monday, February 10, 2014 9:36:13 AM UTC-5, Jim Crossley wrote: > > Maven mul

Re: OT: Enterprise Schedulers

2014-02-10 Thread Alan Moore
While not specifically a scheduling tool, Clara is a forward chaining rule engine that can be used to implement a FSM and/or controller logic. I would imagine you would want to layer this on top of a library like Pallet, Quartz or Storm. Clara's Storm support is useful for distributed computing.

Re: [Kind of off-topic] Enlightenment

2014-02-10 Thread Ivan L
When I was writing a simple lib to work against stock prices and somewhere between a few hofs and a macro or two I ended up accidently with a small dsl for stock prices. I then remembered reading "lisp is the language you write the language to solve the problem in" and it just instantly range t

Re: unconditional append to end

2014-02-10 Thread Sean Corfield
I find clojureatlas.com very helpful for exploring the API, especially since it is concept-based (so "Maps" is a concept that shows all the related functions and concepts). It's only up to 1.4.0 - hopefully Chas will update it to 1.5 / 1.6 at some point - but it's better than a site stuck at 1.

Re: OT: Enterprise Schedulers

2014-02-10 Thread François Rey
On 10/02/14 18:46, Adrian Mowat wrote: Thanks for the info. Quartz and it's Clojure DSLs seem to do some of what I need. I had a quick scan of the docs and they don't appear to support triggers that are not time based (on arrival of a file, on completion of a job etc) - but it was only a quic

Going to SXSW - Come to the Austin Clojure Meetup

2014-02-10 Thread Sam Griffith
Hello Clojarians, If your going to SXSW, then you may want to come to our Austin Clojure Meetup on Monday, March 10th, 2014 at Capital Factory in Austin. The link below will give you more info. http://www.meetup.com/Austin-Clojure-Meetup/events/160607622/ If you are going to come please leave

Re: How would I write it with concurrency

2014-02-10 Thread Jim - FooBar();
If `session` returns a list, why don't you just do `(take 5 (repeatedly session))` ??? with regards to concurrency I am not sure what you're asking...you want to do the same thing from multiple threads and accumulate a global result? Jim On 10/02/14 18:46, Haim Ashkenazi wrote: Hi I have a

Re: How would I write it with concurrency

2014-02-10 Thread Aaron France
Hi, Ignoring your question for a second to recommend using simple-check[0] to generate test data. [0] https://github.com/reiddraper/simple-check Aaron On Mon, Feb 10, 2014 at 08:46:59PM +0200, Haim Ashkenazi wrote: > Hi > > I have a simple code that generates a list of maps: > > (defn test-da

core.async IOC state holds onto previous value?

2014-02-10 Thread Jozef Wagner
Hi, I'm trying to track down what holds onto an object (a vector) I've sent through mult. I got lost in the ioc_macros/take! and its AtomicReferenceArray state. I've sent the value through the mult and it got processed. aftewards, mult processing go block ( https://github.com/clojure/core.async/b

How would I write it with concurrency

2014-02-10 Thread Haim Ashkenazi
Hi I have a simple code that generates a list of maps: (defn test-data [nsamples] (loop [acc []] (if (>= (count acc) nsamples) acc (recur (concat acc (session)) The session function returns a list of one to five generated maps. The idea is to get a list of (not much more

Re: unconditional append to end

2014-02-10 Thread Mars0i
On Sunday, February 9, 2014 11:38:39 PM UTC-6, mynomoto wrote: > > +1 to the Cheat Sheet although I prefer this version: > http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html > Several variations on the cheatsheet are available via links from the main cheatshee

Re: unconditional append to end

2014-02-10 Thread Mars0i
On Monday, February 10, 2014 11:56:18 AM UTC-6, t x wrote: > > Someone needs to make a flappy bird version of > > http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html > > > It provides a description of the function, you type in the function name. > :-) > Like

Re: unconditional append to end

2014-02-10 Thread Stuart Sierra
On Friday, February 7, 2014 7:20:09 PM UTC-5, t x wrote: > Thus, my question: is there a builtin to _unconditinoally_ > append to the end of a list/sequence/vector? Not built in. If you want things to grow at the end, you probably want vectors anyway. So try this: (defn conjv [coll item]

Re: unconditional append to end

2014-02-10 Thread mynomoto
You can see the project of the new clojuredocs.org on https://github.com/clojuredocs/web There is discussion about clojuredocs.org here https://groups.google.com/d/msg/clojure/jWMaop_eVaQ/I-H4Fn1brVcJ But I don't know about the current status. Marcelo On Monday, February 10, 2014 2:22:04 PM U

Re: [ANN] clara-rules 0.4 released

2014-02-10 Thread Alan Moore
Ryan, This release seems to be Clara's best so far - congratulations! Thank you for maintaining ClojureScript compatibility... while I understand that the JVM is likely to be the primary target for rule engine deployment, some of us are centered on either browser or nodejs based systems. Cloju

Re: unconditional append to end

2014-02-10 Thread t x
Someone needs to make a flappy bird version of http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html It provides a description of the function, you type in the function name. :-) On Mon, Feb 10, 2014 at 8:22 AM, Alan Thompson wrote: > Thank you for the cheat sheet

Re: OT: Enterprise Schedulers

2014-02-10 Thread Adrian Mowat
Hi François I totally agree about the scheduling library being only part of the solution. I'm aware of Pallet but I have never used it in anger. The links you have provided look like an interesting angle. I'll start working through them and see if I can figure out an architecture that meets m

Re: OT: Enterprise Schedulers

2014-02-10 Thread Adrian Mowat
Hi François Thanks for the info. Quartz and it's Clojure DSLs seem to do some of what I need. I had a quick scan of the docs and they don't appear to support triggers that are not time based (on arrival of a file, on completion of a job etc) - but it was only a quick scan so I wondered if you

Re: OT: Enterprise Schedulers

2014-02-10 Thread François Rey
On 10/02/14 16:20, Toby Crawley wrote: Actually, Immutant has its own Quartz integration, and is not based on quartz-clj. You can, however, use the Quartzite API with the cluster-aware Quartz scheduler that Immutant provides if you prefer the Quartzite API over the Immutant one. - Toby Thanks

Re: unconditional append to end

2014-02-10 Thread Alan Thompson
Thank you for the cheat sheet refs. Definitely helpful. Anybody have any insight into the current state of clojuredocs.org? Alan On Sun, Feb 9, 2014 at 9:38 PM, mynomoto wrote: > +1 to the Cheat Sheet although I prefer this version: > http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet

Re: [ANN] lein-modules 0.1.0 - multi-module support in Leiningen

2014-02-10 Thread Sam Ritchie
Nice, this looks great! SBT has a great multi-module story; this was the only thing I've missed, moving back from Scala. Thank you! Jim Crossley February 10, 2014 7:36 AM Maven multi-module projects provide support for project aggregation, letting you define paren

Re: Handy clojure function to transform prepared statement queries

2014-02-10 Thread Jan Herich
Thank you for your explanation Kris, i will test this functionality in Yesql. Dňa pondelok, 10. februára 2014 14:40:18 UTC+1 Kris Jenkins napísal(-a): > > Actually, Yesql already supports this, albeit unofficially. Here's an > example, but please read the caveat at the end before you use it... >

Re: OT: Enterprise Schedulers

2014-02-10 Thread Toby Crawley
fmj...@gmail.com writes: > Perhaps I should be more precise: quartz (http://quartz-scheduler.org/) > is a java-based open source scheduler, > and the link I gave earlier is to the clojure integration layer > quartzite (http://clojurequartz.info/)

Re: Error throw when defining function with return type hint

2014-02-10 Thread Jim - FooBar();
On 10/02/14 15:08, macdevign mac wrote: (defn testing (^String []) (.toUpperCase "hello world")) ;;syntax for overloading (defn testing (^String [] ;;notice the omitted bracket (.toUpperCase "hello world")) (^String [^String a] (.toUpperCase a)) ) ;;non-overloaded fns (defn t

Re: Error throw when defining function with return type hint

2014-02-10 Thread macdevign mac
I get it. Thank :} On Monday, February 10, 2014 11:19:06 PM UTC+8, Jim foo.bar wrote: > > On 10/02/14 15:08, macdevign mac wrote: > > (defn testing > > (^String []) > > (.toUpperCase "hello world")) > > > ;;syntax for overloading > (defn testing >(^String [] ;;notice the omitted brac

Re: Monkey-patching in Clojure

2014-02-10 Thread Arnaud BOS
Thanks for the hints. I didn't found any clue while searching the Web with these keywords, maybe others will find this usefull as a reference for future searches. As for the dependency I also thought about adding it as a checkout but I didn't want to maintain it and keep it in sync with the mai

Error throw when defining function with return type hint

2014-02-10 Thread macdevign mac
Hi, I'm new to the clojure and try to learn this language. Referring to this at http://clojure.org/java_interop#Java%20Interop-Type%20Hints when trying this code (defn testing (^String []) (.toUpperCase "hello world")) clojure throws "java.lang.IllegalArgumentException: Parameter decla

Re: OT: Enterprise Schedulers

2014-02-10 Thread François Rey
Perhaps I should be more precise: quartz (http://quartz-scheduler.org/) is a java-based open source scheduler, and the link I gave earlier is to the clojure integration layer quartzite (http://clojurequartz.info/) . Immutant (http://immu

[ANN] lein-modules 0.1.0 - multi-module support in Leiningen

2014-02-10 Thread Jim Crossley
Maven multi-module projects provide support for project aggregation, letting you define parent-child relationships among a group of projects to achieve interdependence-based build ordering, limited project inheritance, and centralized dependency management. Maven's pom.xml files are verbose, er

Re: Monkey-patching in Clojure

2014-02-10 Thread James Reeves
You should be able to just hop into the namespace and redef the function. (in-ns 'namespace.to.change) (def function-to-change ...) However, it's quite easy to fork a project and deploy your own version of it. You just need to change the project name in project.clj from "foo" to "org.clo

Re: OT: Enterprise Schedulers

2014-02-10 Thread François Rey
Considering your enterprise/cloud requirements, it seems that quartz (http://clojurequartz.info/) should be the closest to your needs. It's also integrated into Immutant (http://immutant.org/tutorials/jobs/) . More generally in th

Monkey-patching in Clojure

2014-02-10 Thread Arnaud BOS
Hi, I have a dependency on a library that is no longer under very active development (or at least I'm not certain of it). I did a change and sent a pull request but am not sure when or if it will be merged and deployed. Before I can decide if I need to switch to another dependency (when I'll f

Re: Handy clojure function to transform prepared statement queries

2014-02-10 Thread Kris Jenkins
Actually, Yesql already supports this, albeit unofficially. Here's an example, but please read the caveat at the end before you use it... Define an IN-query with one parameter: -- name: find-by-age SELECT * FROM person WHERE age IN (:age) Call it, supplying a vector for age: (find-by-age db-sp

OT: Enterprise Schedulers

2014-02-10 Thread Adrian Mowat
Hi Everyone, This is a wee bit off topic, but given the sorts of problems the Clojure community likes to solve and the enterprise background of a lot of people I thought this list might be a good place to start. We are building a fairly large web-infrastructure running over a combination of in

Re: Handy clojure function to transform prepared statement queries

2014-02-10 Thread Jan Herich
The "problem" with libraries you mentioned is that those are fully featured DSLs for embedding SQL queries as clojure macros/function calls in your program. However, i like the philosophy of Yesql library, which leverages clojure/java.jdbc library but enc