Performant flattening of nested data structures

2015-02-17 Thread Mark Watson
I want to flatten a map of nested maps/vecs Currently I'm using the fn's: (defn- flatten-keys* [a ks m] (cond (map? m) (reduce into (map (fn [[k v]] (flatten-keys* a (if-not (empty? ks) (str ks

Re: Performant flattening of nested data structures

2015-02-17 Thread Mark Watson
A slightly cleaner version: (defn- flatten-keys* [a ks m] (cond ;; Is a map? (map? m) (reduce into (map (fn [[k v]] (flatten-keys* a (str ks . (name k)) v)) (seq m))) ;; Is an arr/vec/seq? (and

Clojure and Maven

2014-06-13 Thread Mark Watson
Hey guys, New to Maven and need to convert my leiningen project to Maven to integrate with TeamCity. I can run: mvn clean install and it builds the .jar file. However, when I try to run the jar file: java -jar target/my-app-jar-with-dependencies.jar I get the error: Error: Could not

Re: Clojure and Maven

2014-06-13 Thread Mark Watson
Oh, and I have a function: (defn -main []...) In my-namespace.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

Re: Clojure and Maven

2014-06-13 Thread Mark Watson
/mainClass While Clojure uses -'s in namespace names, they are always _'s in the output package/class names. On Friday, June 13, 2014 10:34:54 AM UTC-5, Mark Watson wrote: Hey guys, New to Maven and need to convert my leiningen project to Maven to integrate with TeamCity. I can run: mvn

Re: Clojure and Maven

2014-06-13 Thread Mark Watson
Ah, forgot about that. Still having the same issue with that resolved unfortunately. -- 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

Re: Clojure and Maven

2014-06-13 Thread Mark Watson
There are no .class files in my jar I assume some file-path is messed up, I just can't figure out where. -- 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

Re: Leiningen just hangs

2014-05-16 Thread Mark Watson
processes running (with 4G allocated for a virtual box instance); on my 16G mac it never happens. So freeing up some memory has fixed it for me. On Thursday, May 15, 2014 11:34:36 AM UTC-7, Mark Watson wrote: I'm running Leiningen on CentOS 6.5. Everything was working fine, and today when

Leiningen just hangs

2014-05-15 Thread Mark Watson
I'm running Leiningen on CentOS 6.5. Everything was working fine, and today when I try lein run it just hangs. It takes about 15 minutes for lein version to return. The project works fine on my macbook pro, and another CentOS box. I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen.

Re: Leiningen just hangs

2014-05-15 Thread Mark Watson
I don't have a ~/.lein/profiles.clj file. I removed all the Leiningen files, tried with a fresh install, still no luck. On Thursday, May 15, 2014 2:38:34 PM UTC-4, Gary Trakhman wrote: Did you try to clean out ~/.lein/profiles.clj? On Thu, May 15, 2014 at 2:34 PM, Mark Watson mkw

Re: Leiningen just hangs

2014-05-15 Thread Mark Watson
Tried it On Thursday, May 15, 2014 3:17:58 PM UTC-4, Magomimmo wrote: try removing ~/.m2 On 15 May 2014, at 20:56, Mark Watson mkw...@gmail.com javascript: wrote: I don't have a ~/.lein/profiles.clj file. I removed all the Leiningen files, tried with a fresh install, still no luck

Reduce vs. Comp

2014-05-07 Thread Mark Watson
What is the difference between: (reduce #(%2 %) 6 [(partial + 12) (partial * -1)]) and ((apply comp [(partial * -1) (partial + 12)]) 6) Using reduce *looks* nicer to me, but I feel like I'm re-implementing comp. Their performance is also the same (go inlining!). -- You received this message

Re: Reduce vs. Comp

2014-05-07 Thread Mark Watson
I agree. I guess I was specifically thinking of a list of functions where the length of the list, and the functions themselves, are defined at run-time. Which would lead to some nasty code using the threading macros. (Unless someone has an example of this not being the case) On Wednesday, May

Mock db data for unit tests

2014-03-07 Thread Mark Watson
I have a web service that uses Korma for interacting with my db. To mock data for unit tests I want to re-bind korma.core/select to return known data and not hit a db. Currently I have a db ns: (nsservices.db (:require [korma.core :refer :all] [korma.db :refer :all])) With a

Maximize Fantasy Baseball Lineup

2013-09-13 Thread Mark Watson
Hey, newish user here. I want to make an app that finds the optimal lineup for fantasy baseball games. Each player is assigned a cost, the average points they earn a game, and position. For example: Andrew McCutchen, 3.4, 4900, OF You have to pick one catcher, one pitcher, one first basemen,

Fantasy Baseball Lineup Optimization

2013-09-13 Thread Mark Watson
Hi, newish user here. I want to make an app that finds a simple, optimized, fantasy baseball lineup. Each player has a cost associated with them, as well as the average points per game they score, and position. For example: Mike Napoli, 4600, 2.9, 1B You have to choose one of each position:

Re: A Performance Comparison of SBCL Clojure

2012-08-25 Thread Mark Watson
...@hotmail.com -- Mark Watson, consultant and author: http://markwatson.com It is better to travel well than to arrive. - Buddha -- 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