Re: Inconsistency of dissoc on maps vs records?

2012-04-20 Thread David Jagoe
On 20 April 2012 07:38, Mark Engelberg wrote: > On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe wrote: > >> >> Out of curiosity, why is this useful to you? >> > > It certainly has performance benefits. > > When things are tested for equality (e.g., to test against keys in a hash > map), identical t

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-20 Thread Evan Mezeske
Could you elaborate on what the differences are between your version (Greenberg) of paredit-vim and the original one written by Tamas Kovacs that it appears to be based on? I'm a bit confused -- the latest Kovacs version that I've used is 0.9.3 from November 2011. The Greenberg version looks l

Re: a library I'm working on for generating PDFs from Clojure

2012-04-20 Thread Patrick Wright
Dmitri, you might look at delegating some of the effort to Flying Saucer, which can generate PDFs when given clean HTML and CSS. http://code.google.com/p/flying-saucer/ There is a blog somewhere (which is currently unreachable) of someone using FS from Clojure. HTH, Patrick -- You received

Re: question about a macro

2012-04-20 Thread Marc Limotte
Thomas, Try this: (defmacro my-macro2 [func & args] `(~func ~@(flatten (eval (vec args) Marc On Wed, Apr 18, 2012 at 4:57 PM, thomas kalbe wrote: > Hi, > > I'd like to write a macro which transforms > > (my-macro SomeClass. a b [x y] c [e f]) > > into > > (SomeClass. a b x y c e f) > > (t

[ANN] Finger trees in Clojurescript

2012-04-20 Thread Jozef Wagner
I've ported finger trees from Chouser's https://github.com/clojure/data.finger-tree to the Clojurescript You can find them at https://github.com/wagjo/ftree With finger tree, one can make a persistent collection with amortized constant time access to elements and O(log n) append and split (ins

Re: question about a macro

2012-04-20 Thread nicolas.o...@gmail.com
Part of the problem is that you confuse compile time and runtime. Macro are evaluated at compile-time. So when you write: (my-macro SomeClass. a b) , my-macro can't access the runtime value of a and b. So if you want your second example to work, you need flatten to be called at runtime and not

Re: question about a macro

2012-04-20 Thread nicolas.o...@gmail.com
On Fri, Apr 20, 2012 at 11:14 AM, Marc Limotte wrote: > Thomas, > > Try this: > > (defmacro my-macro2 [func & args] `(~func ~@(flatten (eval (vec args) > > This won't work for: (let [a [2 3]] (my-macro2 SomeClass. a)) -- You received this message because you are subscribed to the Google Gr

Re: question about a macro

2012-04-20 Thread Cedric Greevey
On Thu, Apr 19, 2012 at 7:28 AM, Thomas wrote: > Hi, > > I'd like to write a macro which transforms > > (my-macro SomeClass. a b [x y] c [e f]) > > into > > (SomeClass. a b x y c e f) > > (the order of collections and single values in the arguments should be > arbitrary) > > The closest I came was

Re: [ANN] Finger trees in Clojurescript

2012-04-20 Thread Chris Houser
Cool --Chouser Laboriously typed on my mobile device. On Apr 20, 2012, at 6:17 AM, Jozef Wagner wrote: I've ported finger trees from Chouser's https://github.com/clojure/data.finger-tree to the Clojurescript You can find them at https://github.com/wagjo/ftree With finger tree, one can make a

Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread Matthew Rocklin
I felt like I was spending a large amount of time learning a specialized system. About half the time was learning how to pose problems in a new paradigm and about half the time was dealing with language-specific idiosyncrasies. The first is necessary and good, the second was more frustrating.

Re: [ANN] Finger trees in Clojurescript

2012-04-20 Thread Cedric Greevey
On Fri, Apr 20, 2012 at 8:13 AM, Chris Houser wrote: > Cool > > --Chouser > Laboriously typed on my mobile device. You really need a better "mobile device" if typing a four-letter message is "laborious". ;) -- You received this message because you are subscribed to the Google Groups "Clojure" g

Re: Newbie question about rebinding local variables

2012-04-20 Thread Craig Ching
Thanks for the help to both of you! Question, does it seem heavy handed to do it this way? I mean, atoms are more for thread-safety, aren't they? I don't have threads so it seems a bit much to use atoms for this. Am I better off using recur and trying to loop? Or is this considered an idio

Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread David Nolen
I don't know Maude so I can't speak to much on it - though I've heard good things from many different people. Clojure is fairly well documented - core.logic not so much. People are doing interesting things with it but in order to get proficient it requires quite a bit of reading and research into

Re: Inconsistency of dissoc on maps vs records?

2012-04-20 Thread David Nolen
Calls to = call identity? first. On Fri, Apr 20, 2012 at 2:38 AM, Mark Engelberg wrote: > On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe wrote: > >> >> Out of curiosity, why is this useful to you? >> > > It certainly has performance benefits. > > When things are tested for equality (e.g., to test

Re: Friend: an extensible authentication and authorization library for Clojure Ring webapps and services

2012-04-20 Thread Chas Emerick
Gert, There is no declarative way to satisfy that requirement at the moment. Fine-grained authorization often falls out to imperative checks, though there are mostly-declarative approaches in other libraries/frameworks that I have yet to grok enough to have a feel for what Friend should do in

Re: Newbie question about rebinding local variables

2012-04-20 Thread Walter van der Laan
You could start with pure functions to handle the game logic, e.g.: (defn new-game [] [[\- \- \-] [\- \- \-] [\- \- \-]]) (defn print-game [game] (doseq [row game] (println (apply str row (defn move [game mark pos] (assoc-in game pos mark)) (print-game (new-game)) (print-gam

Re: Newbie question about rebinding local variables

2012-04-20 Thread Craig Ching
On Friday, April 20, 2012 9:07:49 AM UTC-5, Walter van der Laan wrote: > > You could start with pure functions to handle the game logic, e.g.: > > (defn new-game [] > [[\- \- \-] >[\- \- \-] >[\- \- \-]]) > > (defn print-game [game] > (doseq [row game] > (println (apply str row)))

Re: Newbie question about rebinding local variables

2012-04-20 Thread kurtharriger
By creating new game objects rather than mutating existing ones you could do things you wouldnt otherwise be able to do. Perhaps you have different solver strategies that you want to apply in parallel. Provided you can give each solver its own copy this is trivial, but if your datastructures req

Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread Matthew Rocklin
Maude is certainly quite interesting. I definitely hope that it takes off. If there were people in my community who were more familiar with Maude I think it would be a good choice for me. Are you aware of any project that attempts to implement anything like a term rewrite system

Re: Newbie question about rebinding local variables

2012-04-20 Thread kurtharriger
And you just need to keep the resulting state, no need to reapply the moves. Your main method might use a reduce or loop recur. (loop [game (new-game)] (if-not (complete? game) (recur (make-random-move game))) -- You received this message because you are subscribed to the Google Groups

Re: Newbie question about rebinding local variables

2012-04-20 Thread Craig Ching
Thanks for your input, I appreciate it. On Friday, April 20, 2012 10:16:51 AM UTC-5, kurtharriger wrote: > > And you just need to keep the resulting state, no need to reapply the > moves. > Your main method might use a reduce or loop recur. > > (loop [game (new-game)] > (if-not (complete? gam

Re: Newbie question about rebinding local variables

2012-04-20 Thread Phil Hagelberg
On Fri, Apr 20, 2012 at 7:07 AM, Walter van der Laan wrote: > You could start with pure functions to handle the game logic, e.g.: We did this during swarm coding at ClojureWest on the game of Go, but you could apply the same logic to any board game: https://github.com/technomancy/swarm-go/blob/m

Re: Newbie question about rebinding local variables

2012-04-20 Thread Walter van der Laan
You can save state in an atom like this: (def state (atom (new-game))) ; initial state (swap! state move \x [1 1]) ; make a move -- 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 po

Re: Newbie question about rebinding local variables

2012-04-20 Thread nicolas.o...@gmail.com
This is not the idiomatic way but you can stay quite close from your code by: (defn game [ board ] (fn [n i] (cond (= n :x) (game (assoc board i 'x)) ( = n :o) (game (assoc board i 'o)) (= n :print) (println board (defn (new-game (game (in

Twitter api?

2012-04-20 Thread labwork07
I see twitter-api and clojure-twitter in clojars. Which one do you use? -- 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 wi

Twitter api?

2012-04-20 Thread labwork07
I see twitter-api and clojure-twitter in clojars. Which one do you use? -- 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 wi

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread Michał Marczyk
Since the latest PHM patch has now been merged to master (thanks, David!), I wanted to take this opportunity to note that porting all that Java code (including the transient support for PHM -- a working version of which is available for testing in its own ticket [1] -- and now the PersistentTreeMap

Re: Clojars security upgrade

2012-04-20 Thread Phil Hagelberg
On Fri, Mar 9, 2012 at 2:22 PM, Phil Hagelberg wrote: > Because we can't ensure that everyone will log in to re-hash their > password, at some point in the future (probably 2-3 weeks out) we will > WIPE all the old password hashes. Otherwise users who have stopped using > Clojars or missed the ann

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread David Nolen
Excellent work! On Fri, Apr 20, 2012 at 1:38 PM, Michał Marczyk wrote: > Since the latest PHM patch has now been merged to master (thanks, > David!), I wanted to take this opportunity to note that porting all > that Java code (including the transient support for PHM -- a working > version of whic

Re: Newbie question about rebinding local variables

2012-04-20 Thread kurtharriger
On Apr 20, 9:43 am, Craig Ching wrote: > Thanks for your input, I appreciate it. > > On Friday, April 20, 2012 10:16:51 AM UTC-5, kurtharriger wrote: > > > And you just need to keep the resulting state, no need to reapply the > > moves. > > Your main method might use a reduce or loop recur. > >

Re: Twitter api?

2012-04-20 Thread Pooya Razavian
I've used clojure-twitter. Worked as advertised and very smooth. I was curious if anyone tired using the spring social framework. On Friday, April 20, 2012 6:09:07 PM UTC+1, melipone wrote: > > I see twitter-api and clojure-twitter in clojars. Which one do you use? -- You received this message

Converting project.clj to maven's pom.xml

2012-04-20 Thread Murtaza Husain
Hi, Is there any way to convert project.clj to pom.xml. I was looking at jelastic which is a cloud provider for java, and they allow deploying projects from git repos which are compatible with maven 3. It will download the code and build it based on the maven config. Anyway we can leverage tha

Re:Converting project.clj to maven's pom.xml

2012-04-20 Thread Baishampayan Ghose
$ lein pom Sent from phone, please excuse brevity. On Apr 20, 2012 11:59 PM, "Murtaza Husain" wrote: > Hi, > > Is there any way to convert project.clj to pom.xml. > > I was looking at jelastic which is a cloud provider for java, and they > allow deploying projects from git repos which are compat

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread Brent Millare
Quick question, so does this mean we have clojure's persistent data structures implemented in clojurescript or js? This would mean we are one more step closer to C-in-C right? On Friday, April 20, 2012 1:38:17 PM UTC-4, Michał Marczyk wrote: > > Since the latest PHM patch has now been merged to

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread David Nolen
On Fri, Apr 20, 2012 at 2:32 PM, Brent Millare wrote: > Quick question, so does this mean we have clojure's persistent data > structures implemented in clojurescript or js? This would mean we are one > more step closer to C-in-C right? The persistent data structures are implemented in ClojureScr

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread Michał Marczyk
It's pure ClojureScript. Hopefully a step towards CinC, yes. :-) Sincerely, Michał On 20 April 2012 20:32, Brent Millare wrote: > Quick question, so does this mean we have clojure's persistent data > structures implemented in clojurescript or js? This would mean we are one > more step closer to

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread Baishampayan Ghose
The data-structures are written in ClojureScript. Check the source and witness the beauty :-) Sent from phone, please excuse brevity. On Apr 21, 2012 12:02 AM, "Brent Millare" wrote: > Quick question, so does this mean we have clojure's persistent data > structures implemented in clojurescript

Re: a library I'm working on for generating PDFs from Clojure

2012-04-20 Thread Tim Robinson
Also, wkhtmltopdf has worked well for me. http://code.google.com/p/wkhtmltopdf/ On Apr 20, 4:06 am, Patrick Wright wrote: > Dmitri, > > you might look at delegating some of the effort to Flying Saucer, which can > generate PDFs when given clean HTML and > CSS.http://code.google.com/p/flying-sa

[ANN] Typed Clojure 0.1-alpha2

2012-04-20 Thread Ambrose Bonnaire-Sergeant
Hi, I know there are a few people interested in trying Typed Clojure, so I've cut an early alpha release to give a taste. These are *very* early days, but looking through the readme will give you some hints as to what works in this release. Don't expect too much. https://github.com/frenchy64/typ

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Timothy Baldridge
Try lein pom On Apr 20, 2012 1:29 PM, "Murtaza Husain" wrote: > Hi, > > Is there any way to convert project.clj to pom.xml. > > I was looking at jelastic which is a cloud provider for java, and they > allow deploying projects from git repos which are compatible with maven 3. > It will download t

Re: Newbie question about rebinding local variables

2012-04-20 Thread Craig Ching
On Friday, April 20, 2012 1:15:11 PM UTC-5, kurtharriger wrote: > > > Game state does not have to be a map, it could be any datastructure > you want, perhaps a protocol that is implemented by a concrete class > in another JVM language. However, I avoid encapsulation unless there > is a compel

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Ben Smith-Mannschott
"lein pom" may not do all you need. It depends on what you are trying to accomplish. It will generate a pom.xml which identifies your project (artifactId, groupId, version, packaging) and lists its dependencies. This pom is suitable for publishing your artifacts to some Maven repository for others

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Phil Hagelberg
On Fri, Apr 20, 2012 at 1:46 PM, Ben Smith-Mannschott wrote: > It will generate a pom.xml which identifies your project (artifactId, > groupId, version, packaging) and lists its dependencies. This pom is > suitable for publishing your artifacts to some Maven repository for > others to consume. (Th

Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread David Nolen
A quick perusal of Google and I can see that term rewrite systems & Lisp have a very long history. I'm not familiar with any specific Clojure projects, but it seems like a rich field and there's a lot of literature to back you up. David On Fri, Apr 20, 2012 at 11:08 AM, Matthew Rocklin wrote: >

Re: [ANN] Typed Clojure 0.1-alpha2

2012-04-20 Thread Raoul Duke
On Fri, Apr 20, 2012 at 11:50 AM, Ambrose Bonnaire-Sergeant wrote: > https://github.com/frenchy64/typed-clojure very cool. fun to give Typed Racket a race! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure

Re: Twitter api?

2012-04-20 Thread Devin Walters
I've been using twitter-api FWIW. '(Devin Walters) On Friday, April 20, 2012 at 1:16 PM, Pooya Razavian wrote: > I've used clojure-twitter. Worked as advertised and very smooth. I was > curious if anyone tired using the spring social framework. > > On Friday, April 20, 2012 6:09:07 PM UTC+1,

Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread Michael Fogus
I have a bit of a rewrite system built on core.unify at https://github.com/fogus/unifycle, but it's far from comprehensive. -- 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 f

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Murtaza Husain
Hi, Thanks for the answers, they are quite helpful. What I would like to do is this - 1) Use leiningen for development purposes. 2) Gnenerate a pom while pushing to git. 3) Th pom should be good enough so that it can be used by cloud evironments ( http://jelastic.com/docs/maven-cloud-hostin

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Phil Hagelberg
On Fri, Apr 20, 2012 at 6:52 PM, Murtaza Husain wrote: > 3) Th pom should be good enough so that it can be used by cloud evironments > ( http://jelastic.com/docs/maven-cloud-hosting-in-jelastic) for building and > deploying as a war. > > So is the above scenario possible if I just execute lein pom