Maven + LibGDX - HELP!

2013-05-25 Thread JvJ
I am more or less terrible at Maven, but I'm OK with Leiningen. Given that I have some information about a Maven repository ( https://code.google.com/p/libgdx/wiki/MavenProjectSetup#Maven_Archetype), how do I use it with Leiningen? Thanks -- -- You received this message because you are subsc

Re: The Reasoned Schemer chpt 4: "Please pass the aspirin"

2013-05-25 Thread David Nolen
+1 On Sat, May 25, 2013 at 8:12 PM, Austin Haas wrote: > > Hi Brian, > > You should post your question to the miniKanren Google group. > > minikan...@googlegroups.com > > -austin > > -- > Austin Haas > Pet Tomato, Inc. > http://pettomato.com > > > On Sat May 25 10:21 , Brian Craft wrote: > > Wo

Re: Knowledge derivation in core.logic?

2013-05-25 Thread David Nolen
I think Nada Amin has already done something like this with the nominal feature and at least her version was quite simple. Best to ask this question on the miniKanren/core.logic mailing list - http://groups.google.com/forum/#!forum/minikanren David On Sat, May 25, 2013 at 8:44 PM, Adam Saleh wr

Re: Some feedback on coding style

2013-05-25 Thread Mark Engelberg
The most common way to do this in Clojure is to define your function such that if the input is not in the domain, the function returns nil. Since nil and false are the only "falsey" values in Clojure, you can use ordinary tests to determine if the function returned a result. The idiom that lets y

Re: Game Project - HTML5 or Applet?

2013-05-25 Thread JvJ
The combination of CES and LibGDX seems intriguing. I think I'd like to go with that. Stephen, how would you feel about me extending/using your library for the contest? Technically, it's not against the rules, but I still wouldn't feel right if I didn't ask for permission. On Saturday, 25 Ma

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
Thanks for the demo ... the next part of my code will decide if the key is in an atom feed so I will be testing for false in the results too - FTW indeed :D On Saturday, 25 May 2013 21:01:31 UTC+2, atkaaz wrote: > > => (doall (map #(remove :dh-uuid %) > '(({:a2p-id "1", :dh-uuid "ab

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
=> (doall (map #(remove :dh-uuid %) '(({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil}) ({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid *false*})) )) (

Knowledge derivation in core.logic?

2013-05-25 Thread Adam Saleh
Hi, I am trying to implement a simple knowledge derivation program in clojure.core.logic, and I am not sure how to approach it. To be more specific, after I am done, it will be used as a toy cryptographic protocol verifier, that tries to infer what knowledge can attacker get based on some initi

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
This is my latest working invocation: (doall (map #(remove :dh-uuid %) (map find-records query-parts))) (({:a2p-id "3", :dh-uuid nil}) ({:a2p-id "3", :dh-uuid nil})) The list of maps is retained which might be useful later. Thanks On Saturday, 25 May 2013 20:15:19 UTC+2, sdegutis wrote: > > Wou

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
It's as I presented it - a list of a list of maps On Saturday, 25 May 2013 13:27:45 UTC+2, atkaaz wrote: > > can you tell what this returns? > (map find-records query-parts) > > > On Sat, May 25, 2013 at 2:21 PM, Mond Ray > > wrote: > >> I am missing something obvious... I get a list of maps bac

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
On the other hand ... does that mean that the sequence being filtered is not lazy? On Saturday, 25 May 2013 20:09:05 UTC+2, Mond Ray wrote: > > Bingo: > > user=> (filter (complement :dh-uuid) (apply concat (map find-records > query-parts))) > ({:a2p-id "3", :dh-uuid nil} {:a2p-id "3", :dh-uuid n

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Steven Degutis
Wouldn't (remove :dh-uuid (apply concat (map find-records query-parts))) be better? On Sat, May 25, 2013 at 1:09 PM, Mond Ray wrote: > Bingo: > > user=> (filter (complement :dh-uuid) (apply concat (map find-records > query-parts))) > ({:a2p-id "3", :dh-uuid nil} {:a2p-id "3", :dh-uuid nil}) > >

Re: The Reasoned Schemer chpt 4: "Please pass the aspirin"

2013-05-25 Thread Austin Haas
Hi Brian, You should post your question to the miniKanren Google group. minikan...@googlegroups.com -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com On Sat May 25 10:21 , Brian Craft wrote: > Wondering if anyone can give me some pointers with this, as I dive into > logic progra

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
Bingo: user=> (filter (complement :dh-uuid) (apply concat (map find-records query-parts))) ({:a2p-id "3", :dh-uuid nil} {:a2p-id "3", :dh-uuid nil}) Thanks everyone! On Saturday, 25 May 2013 19:29:55 UTC+2, Andy Fingerhut wrote: > > Woops, and here I wasn't being careful enough... You have a

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Andy Fingerhut
Woops, and here I wasn't being careful enough... You have a list (or sequence) of two elements, both of which are lists (or sequences) of maps. You can use (apply concat (map find-records query-parts)) to return a single list containing nothing but maps. Andy On Sat, May 25, 2013 at 10:27 AM, A

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Andy Fingerhut
If (map find-records query-parts) is returning this expression: (({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil}) ({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil})) the

Some feedback on coding style

2013-05-25 Thread David Pollak
Hello, This is my first post to this group. If my post or the tone of my post is not up to this communities standards, please give me feedback so that I can integrate with the community. I'm coming from Scala-land. In Scala, there's a PartialFunction: http://www.scala-lang.org/archives/downloads

Re: I18n

2013-05-25 Thread Rob Jens
Sweet. Thanks Stuart, I had never heard of ST before but now I've read some of the professors papers... I'm in! Op vrijdag 28 augustus 2009 16:39:07 UTC+2 schreef Stuart Sierra het volgende: > > My recommendation would be to keep your localized strings separate > from your source code, either i

The Reasoned Schemer chpt 4: "Please pass the aspirin"

2013-05-25 Thread Brian Craft
Wondering if anyone can give me some pointers with this, as I dive into logic programming. Or point me to a more appropriate forum, if this is the wrong one. I know a lot of you have been trying out core.logic. It was all going well until chapter four. The story so far: introduce some simple fu

Parallelising over a lazy sequence - request for help

2013-05-25 Thread Paul Butcher
I'm currently working on a book on concurrent/parallel development for The Pragmatic Programmers. One of the subjects I'm covering is parallel programming in Clojure, but I've hit a roadblock with one of the examples. I'm hoping that I can get some help to work through it here. The example coun

Designing database API, seeking advice for field types

2013-05-25 Thread Steven Degutis
I'm writing a generic database API, and would love some advice on how you think it should handle field types. Let me give a little background. My project's goal is to offer a single, simplified, Clojure-friendly API for most of your data persistence needs, so that: - you can easily use it in idio

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Steven Degutis
Another solution, repeats itself slightly less: (assoc obj :key (or (:key obj) (something-else-with-side-effects-maybe?))) Not sure I like it much better than the first one. But I usually prefer not writing my own macros/functions when I can avoid it, so it has that plus. On Sat, M

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Jim - FooBar();
I just realised you can also do this to get the same effect of pred-transform...This is the first time I'm using cond->! I'm starting to realise its usefuleness... :) (let [rpred (complement pred)] (cond-> obj (pred obj) identity ;;if true return it untouched (rpred obj) t

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Kelker Ryan
Here's my solution to your problem. Let me know if it helps. ``` user> (defn if-attr [-key obj missing] (if-let [ret (get obj -key)] ret (assoc obj -key missing))) #'user/if-attr user> (if-attr :abc {} "missing-value") {:abc "missing-value"} user> (if-attr :abc {:abc 123} "missing-value") 1

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
yep that was interesting thanks btw; it was a function that was acting like a macro, how odd On Sat, May 25, 2013 at 4:26 PM, Jim - FooBar(); wrote: > so maybe a let + gensym would be in order? >> > > > yes that is what you do to avoid double-evaluation...:) I was making a > different point thou

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Jim - FooBar();
so maybe a let + gensym would be in order? yes that is what you do to avoid double-evaluation...:) I was making a different point though, the fact that definline produces a first class fn which still expands like a macro. Jim -- -- You received this message because you are subscribed to t

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Steven Degutis
Seems like I almost want arbitrary or-like behavior, like only-sometimes-evaluation of a conditional form. I feel like this could have something to do with lazy sequences, since technically has the option of never getting evaluated. We could use map. Will test some things out in nrepl.el and retu

Re: Major Help needed with Uberjar Problem: Work Emergency

2013-05-25 Thread Philip Potter
Are you bumping the version number or are you just trying to overwrite an existing artefact with the same version? When not using SNAPSHOT dependencies, you should always bump the version number when releasing a new artefact. That way, a groupid/artifactid/version triple will unambiguously refer t

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Matching Socks
(update-in obj [:attr] #(or %1 %2) something) (cond-> obj (not (:attr obj)) (assoc :attr something)) -- -- 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

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Cedric Greevey
If the condition is true of the transformed object (e.g., it's "if this condition isn't met, use this method to massage it so it is"), then there's this: (first (filter condition? (map #(%1 obj) [identity transformation]))) It can even use laziness to avoid the transformation, but you'll need (li

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Chris Ford
Here's how I did it, which is similar to what atkaaz and Jim were suggesting: (defn whenever [x applies-to? f] (if (applies-to? x) (f x) x)) (whenever obj :attr #(assoc % :attr something)) (whenever obj some-test some-transformation) On 25 May 2013 15:19, atkaaz wrote: > > > > On Sat, May 25,

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
On Sat, May 25, 2013 at 3:16 PM, Steven Degutis wrote: > > Also I just remembered, sometimes to solve the second one, I would do ((if > condition transformer identity) obj) but that feels ugly. > but the condition has to contain obj, so obj is referred twice ? otherwise i kinda like it > > > On

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Steven Degutis
Thanks, that solution's pretty great, although you're right about the side-effects problem, so I can't always use this solution. Also I just remembered, sometimes to solve the second one, I would do ((if condition transformer identity) obj) but that feels ugly. On Sat, May 25, 2013 at 7:13 AM, C

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Cedric Greevey
Seems to me that (merge {:attr something} obj) answers the OP's question, mentions obj only once, and is short and pithy. OTOH it computes the "something" every time, whether it's needed or not, so in cases where "something" is expensive to compute (or has side effects that should only happen if it

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Steven Degutis
Cedric's answer is best: either (filter :dh-uuid some-list) or (remove :dh-uuid some-list) depending on which list you want. On Sat, May 25, 2013 at 7:10 AM, Cedric Greevey wrote: > Why not just (filter (complement :dh-uuid) seq-of-maps)? Or (remove > :dh-uuid seq-of-maps) even? > > > On Sat, M

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
I wonder why the definline didn't act like a function? => (defn pred-transform [obj pred tf] (if (pred obj) obj (tf obj))) #'cgws.notcore/pred-transform => (pred-transform (println 1) #(not (nil? %)) #(println % ".")) 1 nil . nil => (pred-transform (println 1) nil? #(println % ".")) 1 n

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Cedric Greevey
Why not just (filter (complement :dh-uuid) seq-of-maps)? Or (remove :dh-uuid seq-of-maps) even? On Sat, May 25, 2013 at 7:41 AM, sdegutis wrote: > (def some-list > [{:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} >{:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} >{:a2p-id "3", :dh-uuid nil}]) > >

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
like: => (definline pred-transform [obj pred tf] `(let [o# ~obj] (if (~pred o#) o# (~tf o# #'cgws.notcore/pred-transform => (pred-transform (println 1) nil? #(println % ".")) 1 nil => (pred-transform (println 1) #(not (nil? %)) #(println % ".")) 1 nil . nil On Sat, May 25, 201

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
in which case it does get evaluated twice if form: => (pred-transform (println 1) #(not (nil? %)) #(println % ".")) 1 1 nil . nil => (pred-transform (println 1) nil? #(println % ".")) 1 1 nil so maybe a let + gensym would be in order? On Sat, May 25, 2013 at 3:04 PM, atkaaz wrote: > Shouldn'

Re: Major Help needed with Uberjar Problem: Work Emergency

2013-05-25 Thread Cedric Greevey
Have you restarted the JVM that can't see the new function? Have you checked for older copies along the classpath for that JVM? Is Maven capable of showing an old, stale cached copy under some circumstances? If so, find out how and flush the relevant cache. On Sat, May 25, 2013 at 2:29 AM, Davi

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
Shouldn't it be like: (definline pred-transform [obj pred tf] `(if (~pred ~obj) ~obj (~tf ~obj))) => (pred-transform 1 #(not (nil? %)) println) 1 => (pred-transform 1 nil? println) 1 nil On Sat, May 25, 2013 at 2:55 PM, atkaaz wrote: > just wondering if obj is a form does it get eva

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
just wondering if obj is a form does it get evaluated twice? On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); wrote: > no need for macros... :) > > (definline safe-assoc [m k v] > `(if (contains? ~m ~k) ~m > (assoc ~m ~k ~v))) > > (definline pred-transform [obj pred tf] > `(if ~(pred obj) ~ob

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
didn't know about definline, thanks Jim! On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); wrote: > no need for macros... :) > > (definline safe-assoc [m k v] > `(if (contains? ~m ~k) ~m > (assoc ~m ~k ~v))) > > (definline pred-transform [obj pred tf] > `(if ~(pred obj) ~obj > ~(tf obj)))

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Jim - FooBar();
no need for macros... :) (definline safe-assoc [m k v] `(if (contains? ~m ~k) ~m (assoc ~m ~k ~v))) (definline pred-transform [obj pred tf] `(if ~(pred obj) ~obj ~(tf obj))) Jim On 25/05/13 12:44, atkaaz wrote: may I see the macro for the latter, if you decide to go that way ? thx On

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
may I see the macro for the latter, if you decide to go that way ? thx On Sat, May 25, 2013 at 2:24 PM, Steven Degutis wrote: > There are two patterns I find in my code that I'm still unhappy with but I > don't know how to clean up. > > The first is: (if (:attr obj) obj (assoc obj :attr somethi

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread sdegutis
(def some-list [{:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil}]) If you want to filter out only nil: (filter (comp (complement nil?) :dh-uuid) some-list) If you want to filter out nil or false: (filter (comp identity :dh-uui

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Jim - FooBar();
On 25/05/13 12:24, Steven Degutis wrote: The first is: (if (:attr obj) obj (assoc obj :attr something)) I'm basically saying, give this hash-map an attribute if it doesn't already have it. And just return the thing with an attribute, regardless if I had to add it or not. (if (contains? obj :

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
can you tell what this returns? (map find-records query-parts) On Sat, May 25, 2013 at 2:21 PM, Mond Ray wrote: > I am missing something obvious... I get a list of maps back from a > function and I want to find the elements with nil > > (({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2",

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
without giving this much thought is the % actualy a vector like [:dh-uuid "abc-def-ghi-klm"] ? On Sat, May 25, 2013 at 2:21 PM, Mond Ray wrote: > I am missing something obvious... I get a list of maps back from a > function and I want to find the elements with nil > > (({:a2p-id "1", :dh-uuid "

Any alternatives for these two ugly patterns?

2013-05-25 Thread Steven Degutis
There are two patterns I find in my code that I'm still unhappy with but I don't know how to clean up. The first is: (if (:attr obj) obj (assoc obj :attr something)) I'm basically saying, give this hash-map an attribute if it doesn't already have it. And just return the thing with an attribute, r

filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
I am missing something obvious... I get a list of maps back from a function and I want to find the elements with nil (({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil}) ({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uu

Re: creating maps out of sql

2013-05-25 Thread Mond Ray
My updated approach is now like this: (defn find-uuids [query a2p-id] (sql/with-connection sqlserver (sql/with-query-results rs [query a2p-id] (:uuid (first rs) (defn find-records [{query :main-query from-date :from-date to-date :to-date sub-query-fn :sub-query-fn}] (sql/

Re: Has anyone here played with Wisp?

2013-05-25 Thread David Nolen
It's another interesting Lisp variant to JavaScript compiler but besides a surface like similarity, it doesn't really preserve many of Clojure's semantics (keyword behavior, data structures, immutability, notion of truth, protocols, multimethods, etc). David On Sat, May 25, 2013 at 1:59 AM, Rich

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
ok I got the command (run inside foo-two project): mvn install:install-file -Dfile=../foo-one/target/uberjar+provided/foo-one-0.1.0-SNAPSHOT.jar -DgroupId=self -DartifactId=foo-one-Dversion=0.1.0 -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true -DlocalRepositoryP

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
I could be wrong if it's checking the .md5 (which probably does) I should try to update foo-one and install it in local repo, but I don't really know the command :) On Sat, May 25, 2013 at 11:11 AM, atkaaz wrote: > or let me put it this way, if I touch all the files in local_mvn_repo and > the

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
or let me put it this way, if I touch all the files in local_mvn_repo and then run lein repl (or lein deps then lein repl) the newer foo-one from local_mvn_repo is not copied to .m2 folder, ergo I'll still be using the existing one (I assume you already have an existing one where you didn't define

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
ok nevermind I guess it works anyway: user=> (use 'foo-two.core) nil user=> foo-one.core/bar # I notice that lein copied that self/foo-one-0.1.0.jar into my .m2 folder I wonder if somehow lein didn't do that for you and you're still using the old one check your ~/.m2/self/ folder On Sat, May 2

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
quick note: the foo-one in local_mvn_repo (inside foo_two) is just v 0.1.0 without SNAPSHOT the foo-one project however is 0.1.0-SNAPSHOT On Sat, May 25, 2013 at 10:00 AM, David Williams wrote: > This is really important, and I am totally stumped and on a deadline. > Help is greatly appreciate

Major Help needed with Uberjar Problem: Work Emergency

2013-05-25 Thread David Williams
Please note, this is a duplicate post of a stackoverflow question I just posted, Im extremely stumped and dont know what to make of this http://stackoverflow.com/questions/16747039/clojure-major-emergency-with-import This is really important, and I am totally stumped and on a deadline. Help is

Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread David Williams
This is really important, and I am totally stumped and on a deadline. Help is greatly appreciated. I have a Clojure project called red-black, which in particular contains a file called interval_tree.clj I have been compiling this project with lein uberjar and then using the resulting jar in o