ClojureScript: spurious warning about symbol not being a protocol

2013-05-20 Thread Praki
Hi, For reasons I cant quite fathom, "lein cljsbuild" generates "Symbol X is not a protocol" warning. I am using clojure 1.5.1 and cljsbuild 0.3.2. The following code snippet reproduces the issue. Please note that renaming "my.foo" namespace to "foo" compiles with no warning. ;; file:: foo.clj

Re: Design/structure for a game loop in clojure

2013-05-20 Thread Mikera
You've described almost exactly the state update model used in Ironclad: https://github.com/mikera/ironclad I'd strongly suggest taking a look at the Ironclad source if your game is anything vaguely turn-based / strategic. Some comments: - A big, single immutable data structure for the entire g

Re: Design/structure for a game loop in clojure

2013-05-20 Thread George Oliver
On Sunday, May 19, 2013 6:02:23 PM UTC-7, Daniel Wright wrote: > > thoughts/guidance appreciated! > > You might get something out of http://clojurefun.wordpress.com/2013/03/ -- "In this (somewhat extended) post I’m going to describe my experiences using Clojure for the 7DRL challenge – with di

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Gary Trakhman
Ramesh, I think the main problem is you're trying to do a recursion over a tree, so you're blowing a stack if you're not careful, concat is lazy so I think you're just shifting the problem around, file-seq gets around this by using tree-seq, which uses 'walk', which is a linearization of the tree.

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Gary Trakhman
yes it does.. user> (clojure.pprint/pprint (take 20 (file-seq (clojure.java.io/file"/" (# # # # # # # # # # # # # # # # # # # #) On Mon, May 20, 2013 at 4:43 PM, Jim - FooBar(); wrote: > well no it doesn't descent into directories...I just tried it... > > Jim > > > On 20/

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Ramesh
So, I think concat is the problem here. I wish there were recommendation for other options and reason in the Stacktrace to help me code better! And file-seq is exactly what I'm looking for :). Thanks all! Thanks, ramesh On Mon, May 20, 2013 at 1:21 PM, Ben Wolfson wrote: > Basically, you can

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Jim - FooBar();
well no it doesn't descent into directories...I just tried it... Jim On 20/05/13 21:39, Jim - FooBar(); wrote: actually yes it is! :) I thought file-seq was going down one level only but looking at the implementation it seems it goes down all levels...I'm trying it out now Jim On 20/05/13 2

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Jim - FooBar();
actually yes it is! :) I thought file-seq was going down one level only but looking at the implementation it seems it goes down all levels...I'm trying it out now Jim On 20/05/13 21:31, Gary Trakhman wrote: Is this not sufficient? file-seq https://github.com/clojure/clojure/blob/master/src/cl

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Gary Trakhman
Is this not sufficient? file-seq https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4478 On Mon, May 20, 2013 at 4:28 PM, Jim - FooBar(); wrote: > have you considered using mapcat recursively? something like this > perhaps? > > (defn list-all-files [^java.io.File dir] >

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Jim - FooBar();
have you considered using mapcat recursively? something like this perhaps? (defn list-all-files [^java.io.File dir] (let [children (.listFiles dir) directories (filter #(.isDirectory %) children) files (filter #(.isFile %) children)] (concat files (mapcat list-all-files dire

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Ben Wolfson
Basically, you can't use "concat" in a loop like that. You could wrap it in a (doall ...) to avoid the stack overflow. On Mon, May 20, 2013 at 1:12 PM, Ramesh wrote: > Hi all, > > I have the following function to list all the files recursively under a > directory. > > (defn list-all-files2 [pat

Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Ramesh
Hi all, I have the following function to list all the files recursively under a directory. (defn list-all-files2 [path] (let [basepath (java.io.File. path)] (loop [origlist [basepath] finallist []] (if-let [cur (first origlist)] ;This line is not required (if (.isDirectory cur) (recur (concat (

[ANN] Yet another CSS DSL.

2013-05-20 Thread JeremyS
Hi guys, At the risk of being redundant (I am thinking Garden) I have released some libraries to generate css from clojure data structures. Take a look at my github if you are interested. It's one my first clojure project and I'd r

Re: Design/structure for a game loop in clojure

2013-05-20 Thread Gary Trakhman
I thought this approach was interesting: http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/ A key insight I've seen promoted in other places is to use flattened structures and identities instead of nested object hierarchies, thus your handy sub-lists may be represented as graph queries

Re: Design/structure for a game loop in clojure

2013-05-20 Thread Raoul Duke
potential food for thought for you: http://s3.amazonaws.com/ns999/asteroids.html http://prog21.dadgum.com/23.html http://world.cs.brown.edu/ -- -- 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: More idiomatic way to find the first non-nil function result?

2013-05-20 Thread Gary Trakhman
boolean algebra... demorgan's laws.. etc.. http://en.wikipedia.org/wiki/De_Morgan's_laws On Mon, May 20, 2013 at 1:38 PM, Jeb wrote: > Is there a term/phrase that describes this style of programming (as > opposed to nested ifs, for example)? > > > On Wednesday, May 1, 2013 12:46:36 PM UTC-5, Ce

Re: [ANN] enlive-partials 0.2.0

2013-05-20 Thread Jeb
Just what I was looking for last week -- many thanks! On Monday, May 20, 2013 12:41:50 PM UTC-5, Erik Bakstad wrote: > > enlive-partials (http://github.com/ebaxt/enlive-partials) adds support > for wrapping and including enlive templates. It is convenient when you want > to give designers a sand

Design/structure for a game loop in clojure

2013-05-20 Thread Daniel P. Wright
Hello, I am trying to structure the game loop for a simple game in clojure, trying to keep things pure as far as possible to get a feel for how this would work in a functional environment. Currently, I am working with a message-based system, whereby various events create "messages" which I then a

Re: More idiomatic way to find the first non-nil function result?

2013-05-20 Thread Jeb
Is there a term/phrase that describes this style of programming (as opposed to nested ifs, for example)? On Wednesday, May 1, 2013 12:46:36 PM UTC-5, Cedric Greevey wrote: > > What about > > (or > (validate-data-1 data-1) > (validate-data-2 data-2) > (validate-data-3 data-3)) > -- -- You

[ANN] enlive-partials 0.2.0

2013-05-20 Thread Erik Bakstad
enlive-partials (http://github.com/ebaxt/enlive-partials) adds support for wrapping and including enlive templates. It is convenient when you want to give designers a sandbox to work with html templates without having to learn enlive/Clojure. New in version 0.2.0 is support for replace-vars: h

wouldn't this be an interesting clojure code editor?

2013-05-20 Thread atkaaz
Hi guys. I just stumbled upon something [1] and the editor is quite similar to what I was hoping/focusing on having(these days) for editing/writing (not just) clojure code. What are your thoughts on this? (just don't think too much of it in that is for java and ignore the 3D thing) To see what I

Re: seancorfield /clj-soap

2013-05-20 Thread Sean Corfield
I had to revert to Axis 1.x for compatibility with some 3rd party code I don't control that has to run in the same servlet container as our Clojure code. The Axis 2.x wrapper looked much nicer but we couldn't use it. Sean On Sat, May 18, 2013 at 5:32 PM, Marc Boschma wrote: > Well understood Sea

Auto-compiling HAML / SCSS

2013-05-20 Thread Timothy Washington
Hi all, I'm trying to find a Clojure solution for auto-compiling HAML and SCSS code. I came across https://github.com/rtircher/lein-haml-sass, but that fails when I try to compile with "*lein haml once*" or "*lein haml auto*". Has anyone gotten this setup working? Or is there otherwise any other C