Method overloading by the arity in proxy

2012-10-30 Thread Nikita Beloglazov
Hi. I have a java class that has 2 methods with same but different arities 
(one take no arguments, other takes 1 argument). I create a proxy that 
overrides both this methods. The problem is that if no-arg method is called 
from this java class - base implementation is called instead of proxie's. 
Here is an example: https://gist.github.com/3978729. But if I call no-arg 
method directly on obj - correct proxy method is invoked. I can't 
understand this behavior.

Thank you,
Nikita Beloglazov

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Is game development Clojure(functional in general) friendly?

2012-10-30 Thread titon barua
Hi,
I am very new to Clojure and functional programming in general. I am game 
development enthusiast(although did nothing more than a tetris clone in 
python and C). As far as i've seen OpenGL, it's mostly state manipulation 
and seems to me like completely against Clojure's philosophy. Could there 
exist some kind of magic that makes all the state manipulations disappear?

By the way, I think Clojure's concurrency capabilities can upsurge a new 
era for game development as "GigaHertz war" have pretty much stopped and 
game developers are  still reluctant to use full capabilities of multi-core 
hardware. Perhaps they didn't discover clojure yet? (:

I for one would like some good and maintained wrappers for input and 
graphics in Clojure - like SDL and OpenGL.

Disclaimer: I am a wannabe game dev chained to internet/web paradigm for 
financial reasons ... :(

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread Baishampayan Ghose
Titon,

Not Clojure, but this blog series will give you an idea about how to
implement games of the Tetris sort in a FP language -

http://prog21.dadgum.com/23.html

Regards,
BG

On Tue, Oct 30, 2012 at 12:00 AM, titon barua  wrote:
> Hi,
> I am very new to Clojure and functional programming in general. I am game
> development enthusiast(although did nothing more than a tetris clone in
> python and C). As far as i've seen OpenGL, it's mostly state manipulation
> and seems to me like completely against Clojure's philosophy. Could there
> exist some kind of magic that makes all the state manipulations disappear?
>
> By the way, I think Clojure's concurrency capabilities can upsurge a new era
> for game development as "GigaHertz war" have pretty much stopped and game
> developers are  still reluctant to use full capabilities of multi-core
> hardware. Perhaps they didn't discover clojure yet? (:
>
> I for one would like some good and maintained wrappers for input and
> graphics in Clojure - like SDL and OpenGL.
>
> Disclaimer: I am a wannabe game dev chained to internet/web paradigm for
> financial reasons ... :(
>
> --
> 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 your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread nicolas.o...@gmail.com
The usual approach to this kind of things is to have a Functional
representation of the world, that contains the game logic. To have
pure functions that modifies the world with the time and inputs of
players.
And everytime you want to render a frame to call a render function
that does all the work.

It is not clear whether you can have maximal performance with this
approach, in Clojure, on the JVM, but you can surely do something
decent.

This kind of appraoch is used in How To Design Program, v. 2. This
link shows the idea in Racket (another Lisp variant)
but it could give idea on how to do that in Clojure:

http://docs.racket-lang.org/teachpack/2htdpuniverse.html

They also did a free book:
http://world.cs.brown.edu/

As a rule of thumb, the idea with FP is always to pull out effects
towards the spine of the program and keep the remainder pure. (This
is, of course, not a law and should be adapted to practice)
Here instead of mixing your game logic and your rendering, which put
effects everywhere, you work only on pure data and at the very top you
use your data to draw a world.

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Method overloading by the arity in proxy

2012-10-30 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Dienstag, 30. Oktober 2012 08:14:22 UTC+1 schrieb Nikita Beloglazov:
>
> Hi. I have a java class that has 2 methods with same but different arities 
> (one take no arguments, other takes 1 argument). I create a proxy that 
> overrides both this methods. The problem is that if no-arg method is called 
> from this java class - base implementation is called instead of proxie's. 
> Here is an example: https://gist.github.com/3978729. But if I call no-arg 
> method directly on obj - correct proxy method is invoked. I can't 
> understand this behavior.
>

proxy-super temporarily removes the method from the proxy map. So recursive 
calls see directly the parent method.

Kind regards
Meikel

Shameless self-promotion: 
http://kotka.de/blog/2010/03/proxy_gen-class_little_brother.html 

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: monads

2012-10-30 Thread nicolas.o...@gmail.com
In a few lines:
Monads are a common framework to represent any sequential computation.
What is a sequential computation?
- either no computation at all.
   return :: a -> m a
   does that.
- or I have already a computation and want to go on with my computation.
  But then, I need to be able to look at the result of the first part
of the computation
  to now what to do next:
  bind :: m a -> (a -> m b) -> m b
  This tells: If I have a computation returning a value of type a, and
when I will know a, I will be
   able to create a computation returning some b, then I can sequence
those and make a computation
  returning some b. When I want to run it, I will run the first and
use the result to construct the second
   and then run it. *

What is interesting is that you have a representation of sequential
computations and can use a common libraries of
functions to work with any kind of sequential things. And there are a
lot of things that corresponds to this:
side-effects, logic programming, parsing...

Nicolas.

* The monadic notion of sequential computation allows to look at
intermediate results to determine what to do next.
  You obtain other notion of computations like Arrows or Applicative
functors if you restrict this right.

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Method overloading by the arity in proxy

2012-10-30 Thread Nikita Beloglazov
Thank you, Meikel. Seem I'll need to move to gen-class instead :(

Nikita

On Tuesday, October 30, 2012 12:41:41 PM UTC+3, Meikel Brandmeyer (kotarak) 
wrote:
>
> Hi,
>
> Am Dienstag, 30. Oktober 2012 08:14:22 UTC+1 schrieb Nikita Beloglazov:
>>
>> Hi. I have a java class that has 2 methods with same but different 
>> arities (one take no arguments, other takes 1 argument). I create a proxy 
>> that overrides both this methods. The problem is that if no-arg method is 
>> called from this java class - base implementation is called instead of 
>> proxie's. Here is an example: https://gist.github.com/3978729. But if I 
>> call no-arg method directly on obj - correct proxy method is invoked. I 
>> can't understand this behavior.
>>
>
> proxy-super temporarily removes the method from the proxy map. So 
> recursive calls see directly the parent method.
>
> Kind regards
> Meikel
>
> Shameless self-promotion: 
> http://kotka.de/blog/2010/03/proxy_gen-class_little_brother.html 
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Using clj-soap

2012-10-30 Thread diepeglo
Is someone using clj-soap? I tried and it fails with the same error. 

On Friday, July 13, 2012 4:35:39 AM UTC+2, Sean Corfield wrote:
>
> On Thu, Jul 12, 2012 at 7:34 PM, Sean Corfield 
> > 
> wrote: 
> > When I looked at (soap/client-proxy 
> > "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL";) it indicated there 
> > was no such method. I redefined weather with (client 
> > :GetCityWeatherByZIP "10001") and that gave a different error: 
>
> There's a :GetCityForecastByZIP method but that gives the same 
> multimethod error (for :ForecastReturn). 
> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: reduce, reduce-kv, map, mapv, reducers/map and nil

2012-10-30 Thread abp

>
> I find this behaviour quite unfortunate because I now have to explicitly 
> test 
> for nil? and ensure consistent behaviour.


Yes, especially unfortunate considering that Rich said the reducers lib 
could be used as a drop in replacement for core to speed up programs, or 
something along the lines.

On Monday, October 29, 2012 2:00:35 PM UTC+1, Wolodja Wentland wrote:
>
> Hi all, 
>
> I am currently testing performance of different reduce and map 
> implementations 
> in my programs and have problems because their treatment of nil is 
> different. 
> The "normal" clojure.core implementations of reduce and map work well when 
> called on nil, but reduce-kv and functions in clojure.reducers throw 
> exceptions. 
>
> --- snip --- 
> user=> (defn fold-into-vec 
>   "Provided a reducer, concatenate into a vector. 
>
>   Note: same as (into [] coll), but parallel." 
>   ([coll] 
>(r/fold (r/monoid into vector) conj coll)) 
>   ([n coll] 
>(r/fold n (r/monoid into vector) conj coll))) 
>
> user=> (map (fn [el] (* 2 el)) nil) 
> () 
> user=> (mapv (fn [el] (* 2 el)) nil) 
> [] 
> user=> (fold-into-vec (r/map (fn [el] (* 2 el)) nil)) 
> # implementation of method: :coll-fold of protocol: 
> #'clojure.core.reducers/CollFold found for class: nil> 
> user=> (reduce (fn [ret el] (+ el el)) {} nil) 
> {} 
> user=> (reduce (fn [ret [k v]] (+ k v)) {} nil) 
> {} 
> user=> (reduce-kv (fn [ret k v] (+ k v)) {} nil) 
> # implementation of method: :kv-reduce of protocol: 
> #'clojure.core.protocols/IKVReduce found for class: nil> 
> --- snip --- 
>
> I find this behaviour quite unfortunate because I now have to explicitly 
> test 
> for nil? and ensure consistent behaviour. This inconsistency violates the 
> principle of least-surprise and I am not sure if the current behaviour is 
> intentional or merely an unfortunate implementation detail. 
>
> Wouldn't it make sense if reduce-kv and r/map mirror the behaviour of 
> reduce, 
> map and mapv in core? 
>
> P.S. Would it be possible to have something like fold-into-vec in 
> clojure.reducers? 
> -- 
> Wolodja > 
>
> 4096R/CAF14EFC 
> 081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC 
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread Dimitrios Jim Piliouras
I cannot say for sure whether this is something that would interest you
but  I'm currently writing a library just for this reason...That is,
developing games in Clojure. I am sort of giving emphasis to board games
but I don't see why one could not build tetris or sudoku or monopoly etc
etc...My goal is for the end-user to be able to express an entire game,
show it up on screen and genetically train a 'brain' that learns how to
play the game the game *on its own* (no human knowledge is required
upfront) in an afternoon or 2 ! The lib is almost ready and I've coded
chess and checkers already with it...It goes without saying that my main
approach is purely functional (apart from the GUI)... However, I'm exposing
'fast' versions of some core functions (that deal with native java arrays
instead of clojure vectors) just in case a consumer wants them (i am
advising against that though)...if you want to have a look just search for
"Clondie24" on github...

Jim

ps: my chess implementation is just over 120-130 lines of code and checkers
is even less so in a sense I feel like I've succeeded in what I was trying
to accomplish... the moving rules of each game are completely
de-complected  form the actual game (coded in core.logic) which means that
at least for chess, calculating how a piece should move is simply a
hash-map lookup (super-fast)...the only calculation needed when you
actually play is walking the move to check if it collides with
anything...Traversing the tree of moves is done with a fork-join based
minimax implementation using reducers... Yes it is naive (exhaustive search
- no heuristics), but because it is parallel I can get to level 4 in less
than 8-9 seconds and level 6 in less than 40 seconds...These are not
generally reasonable timings if you want to do evolutionary training but I
plan to train on a cluster rather than a single machine



On Tue, Oct 30, 2012 at 11:41 AM, nicolas.o...@gmail.com <
nicolas.o...@gmail.com> wrote:

> The usual approach to this kind of things is to have a Functional
> representation of the world, that contains the game logic. To have
> pure functions that modifies the world with the time and inputs of
> players.
> And everytime you want to render a frame to call a render function
> that does all the work.
>
> It is not clear whether you can have maximal performance with this
> approach, in Clojure, on the JVM, but you can surely do something
> decent.
>
> This kind of appraoch is used in How To Design Program, v. 2. This
> link shows the idea in Racket (another Lisp variant)
> but it could give idea on how to do that in Clojure:
>
> http://docs.racket-lang.org/teachpack/2htdpuniverse.html
>
> They also did a free book:
> http://world.cs.brown.edu/
>
> As a rule of thumb, the idea with FP is always to pull out effects
> towards the spine of the program and keep the remainder pure. (This
> is, of course, not a law and should be adapted to practice)
> Here instead of mixing your game logic and your rendering, which put
> effects everywhere, you work only on pure data and at the very top you
> use your data to draw a world.
>
> --
> 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
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: reduce, reduce-kv, map, mapv, reducers/map and nil

2012-10-30 Thread Herwig Hochleitner
I've also run into this. Maybe this is just an oversight, since clojure
handles nils gracefully almost everywhere else.

Should CollFold and IKVReduce be extended to nil, or is there some
rationale against it?

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread Tim Olsen
Hello Clojurians.

Normally by some IEEE floating-point standard, division by 0.0 should
give Infinity (or NaN if the divisor is also 0.0).  This is the case
when using primitive doubles in clojure:

(/ 1.0 0.0)
=> Infinity

And even when using boxed Doubles in java:

public class BoxedDoubleDivideZero {

public static void main(String[] args) {
Double a = new Double(4.0);
Double b = new Double(0.0);

System.out.println(a/b);
}
}

$ javac BoxedDoubleDivideZero.java
$ java BoxedDoubleDivideZero
Infinity

But it is not the case when using boxed Doubles in clojure:

(/ (Double. 1.0) (Double. 0.0))
ArithmeticException Divide by zero  clojure.lang.Numbers.divide
(Numbers.java:156)

Is this considered a bug or feature?

Thanks,
Tim

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread Raoul Duke
On Tue, Oct 30, 2012 at 2:41 AM, nicolas.o...@gmail.com
 wrote:
> It is not clear whether you can have maximal performance with this
> approach, in Clojure, on the JVM, but you can surely do something
> decent.

btw, i think some folks have mentioned these trade-offs before:

http://groups.google.com/group/clojure/browse_thread/thread/3cb4fa406a17faa1/7bfaa96399a6390f#7bfaa96399a6390f

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: CLJS: println stopped working (r1514) ?

2012-10-30 Thread Frank Siebenlist
Thanks for checking - I confirmed that it seems to work when you use the repl 
in the out-of-the-box lein-cljsbuild environment with a browser.

However, I've moved to a single server set-up with noir/ring running on the 
repl-server, and there the printing doesn't work… but it does when I assign 
(set! *print-fn* clojure.browser.repl/repl-print). Guess that makes it my issue 
;-)

Tried to look for the reason, but couldn't find it - the same assignement seems 
to come down with the embedded javascript in the repl-webpage (?) - but then I 
just put the assignement in the user.cljs file and it doesn't bother me anymore.

After getting more experience with cljs-development of apps, though, I do 
believe that being able to run the cljs-repl on the same web server, and served 
on the same port, makes config much easier and flexible…

-FrankS.



On Oct 27, 2012, at 2:59 PM, David Nolen  wrote:

> On Tue, Oct 23, 2012 at 4:18 PM, Frank Siebenlist 
>  wrote:
> Bump.
> 
> Could someone please confirm that printing from the repl doesn't work anymore?
> 
> Thanks, Frank.
> 
> I just checked browser REPL on CLJS master - it works fine for me.
> 
> David 
> 
> -- 
> 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 your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Using clj-soap

2012-10-30 Thread Sean Corfield
FWIW, since I said I had made some progress in this thread, I
eventually gave up and went with raw Java SOAP API calls (Axis 1.x)
and Java classes generated by wsdl2java since I really only needed a
one-off solution. I stopped looking at clj-soap in late July...

Sean

On Tue, Oct 30, 2012 at 3:00 AM, diepeglo  wrote:
> Is someone using clj-soap? I tried and it fails with the same error.
>
> On Friday, July 13, 2012 4:35:39 AM UTC+2, Sean Corfield wrote:
>>
>> On Thu, Jul 12, 2012 at 7:34 PM, Sean Corfield 
>> wrote:
>> > When I looked at (soap/client-proxy
>> > "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL";) it indicated there
>> > was no such method. I redefined weather with (client
>> > :GetCityWeatherByZIP "10001") and that gave a different error:
>>
>> There's a :GetCityForecastByZIP method but that gives the same
>> multimethod error (for :ForecastReturn).

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


[core.logic] Detecting overlapping FDs

2012-10-30 Thread Anthony Rosequist
I'm playing around with core.logic, and have this code so far:

https://gist.github.com/3981557

There are 2 people and 3 tasks. Each task has a start time (you can't start 
the task until this time or later), and end time (you must finish the task 
by this time), and a duration (how long it takes to perform the task). Time 
is just an integer.

My answer includes 3 vectors of the form: [task-id, person-id, start-time, 
end-time], where person-id is the person doing the task, and 
start-time/end-time are when the task was done (must fall within the start 
and end times of the task).

I have two goals: one of them ensures that the second element of each 
vector is a person, and the other ensures that the times are correct.

Now, I want to prevent the same person from doing two tasks at the same 
time. In other words, for any two vectors in the result, either the 
person-id must be different or the start/end times must not overlap.

I've tried some things (using conde, !=, and <=fd), and can't seem to get 
it to work. Is this easy to do? Am I going about this entire problem the 
wrong way?

Also, how can I make time-intervalso (or any of my code) look better? It 
doesn't look nearly as elegant as the core.logic code I've seen elsewhere.

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread John Gabriele
On Tuesday, October 30, 2012 3:00:07 AM UTC-4, titon barua wrote:

>
> I for one would like some good and maintained wrappers for input and 
> graphics in Clojure - like SDL and OpenGL.
>
>
For graphics, you might have a look at [quil]. It makes use of the 
[Processing] graphics environment.

[quil]: https://github.com/quil/quil
[Processing]: http://www.processing.org/

---John

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [core.logic] Detecting overlapping FDs

2012-10-30 Thread David Nolen
On Tue, Oct 30, 2012 at 1:11 PM, Anthony Rosequist <
anthony.rosequ...@gmail.com> wrote:

> I'm playing around with core.logic, and have this code so far:
>
> https://gist.github.com/3981557
>
> There are 2 people and 3 tasks. Each task has a start time (you can't
> start the task until this time or later), and end time (you must finish the
> task by this time), and a duration (how long it takes to perform the task).
> Time is just an integer.
>
> My answer includes 3 vectors of the form: [task-id, person-id, start-time,
> end-time], where person-id is the person doing the task, and
> start-time/end-time are when the task was done (must fall within the start
> and end times of the task).
>
> I have two goals: one of them ensures that the second element of each
> vector is a person, and the other ensures that the times are correct.
>
> Now, I want to prevent the same person from doing two tasks at the same
> time. In other words, for any two vectors in the result, either the
> person-id must be different or the start/end times must not overlap.
>
> I've tried some things (using conde, !=, and <=fd), and can't seem to get
> it to work. Is this easy to do? Am I going about this entire problem the
> wrong way?
>
> Also, how can I make time-intervalso (or any of my code) look better? It
> doesn't look nearly as elegant as the core.logic code I've seen elsewhere.
>

Looks fun! :) I'll give seem feedback later today.

David

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread JvJ
Check out Penumbra : https://github.com/ztellman/penumbra

I'm currently working on a side-project that integrates Penumbra and 
JBox2D.  It's really just in its beginning phases, but I'm trying to find 
functional ways of updating the game state.  However, I still end up using 
atoms for global references.

Here it is, if you want to take a look: https://github.com/JvJ/enjine, but 
remember it's very VERY preliminary.

On Tuesday, 30 October 2012 03:00:07 UTC-4, titon barua wrote:
>
> Hi,
> I am very new to Clojure and functional programming in general. I am game 
> development enthusiast(although did nothing more than a tetris clone in 
> python and C). As far as i've seen OpenGL, it's mostly state manipulation 
> and seems to me like completely against Clojure's philosophy. Could there 
> exist some kind of magic that makes all the state manipulations disappear?
>
> By the way, I think Clojure's concurrency capabilities can upsurge a new 
> era for game development as "GigaHertz war" have pretty much stopped and 
> game developers are  still reluctant to use full capabilities of multi-core 
> hardware. Perhaps they didn't discover clojure yet? (:
>
> I for one would like some good and maintained wrappers for input and 
> graphics in Clojure - like SDL and OpenGL.
>
> Disclaimer: I am a wannabe game dev chained to internet/web paradigm for 
> financial reasons ... :(
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Build Issues with Eclipse

2012-10-30 Thread JvJ
Thanks for this.  I think I'm getting somewhere, but I'm still having some 
problems.

I'm trying to use lein-localdeps.  I seem to have been able to install the 
jar to my local repository, but when I run lein deps it says it can't find 
it.
Also, I have some native dependencies that aren't being installed.

Any ideas?

On Monday, 29 October 2012 20:17:45 UTC-4, David McNeil wrote:
>
> Does this thread address your need?
>
>
> https://groups.google.com/forum/?fromgroups=#!searchin/clojure/local$20repository$20/clojure/1Ne8RqiffVI/aGoCPWiiCakJ
>
> -David

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread JvJ
I executed the same test in java and got "infinity" as a result.  What 
version of the JDK are you using?  I'm using 1.7

On Tuesday, 30 October 2012 11:10:17 UTC-4, Tim Olsen wrote:
>
> Hello Clojurians. 
>
> Normally by some IEEE floating-point standard, division by 0.0 should 
> give Infinity (or NaN if the divisor is also 0.0).  This is the case 
> when using primitive doubles in clojure: 
>
> (/ 1.0 0.0) 
> => Infinity 
>
> And even when using boxed Doubles in java: 
>
> public class BoxedDoubleDivideZero { 
>
> public static void main(String[] args) { 
> Double a = new Double(4.0); 
> Double b = new Double(0.0); 
>
> System.out.println(a/b); 
> } 
> } 
>  
> $ javac BoxedDoubleDivideZero.java 
> $ java BoxedDoubleDivideZero 
> Infinity 
>
> But it is not the case when using boxed Doubles in clojure: 
>
> (/ (Double. 1.0) (Double. 0.0)) 
> ArithmeticException Divide by zero  clojure.lang.Numbers.divide 
> (Numbers.java:156) 
>
> Is this considered a bug or feature? 
>
> Thanks, 
> Tim 
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN Clojure documentation site (CDS) progress report for the week of October 28th, 2012

2012-10-30 Thread titon barua
+1 for clojure-doc.org. As a beginner, i greatly appreciate your efforts 
and think this solves the 'lack of beginner friendly documentation' problem 
very well.  Keep up the good work. :)

On Monday, October 29, 2012 3:57:36 AM UTC+6, Michael Klishin wrote:
>
> ## TL;DR
>
> The Clojure documentation project (http://clojure-doc.org) continues to 
> make progress.
> Lion's share of the work this week went into the Concurrency and 
> Parallelism guide:
>
> http://clojure-doc.org/articles/language/concurrency_and_parallelism.html
>
> which is now about 75% complete.
>
>
> ## CDS Progress Report
>
> The Clojure Documentation Site (a.k.a. CDS) publishes
> periodic reports (every week so far, possibly two weeks in the future)
> to give the Clojure community a better idea of what CDS shapes up to
> be and what it has to offer.
>
> This is a report for the week ending October 28st, 2012.
>
>
> ## New Content
>
> This week was all improvements to existing guides, no new content merged. 
> There is at least one new tutorial
> in the works by a contributor we've heard from, though.
>
>
> ## Updates
>
> By far most of the work merged this week went into the Concurrency and 
> Parallelism guide [1]
>
> It now covers topics such as
>
>  * An overview of concurrency terminology and common hazards
>  * Identity/Value separation in Clojure
>  * atoms
>  * agents
>  * refs, STM in Clojure, STM limitations
>  * vars
>  * delays
>  * futures
>  * promises
>  * dereferencing
>  * some commonly used `java.util.concurrent` bits
>  * other approaches to concurrency on the JVM available to Clojure through 
> libraries
>
> Reading that guide is highly recommended for developers of all expertise 
> levels with the language.
>
>
> Tutorials updated this week:
>
>  * Getting Started With Emacs for Clojure [2]
>
> Other guides updated this week:
>
>  * Functions [3]
>  * clojure.core Overview [4]
>  * Interoperability with Java [5]
>  * Community [6]
>
>
>
> ## Thank You, Contributors
>
> CDS would not be possible without the following people who make Clojure 
> community a better place:
>
>  * AtKaaZ
>  * Ben Poweski
>  * John Gabriele
>  * Lee Hinman
>  * Michael S. Klishin
>  * Wes Freeman
>
>
> ## You Can Help!
>
> ### How It Works
>
> We have a repository on GitHub [7] that has Markdown files, toolchain 
> setup instructions and several articles
> as well as stubs for several more articles. The stubs help contributors 
> pick a topic to write about and not worry too much about
> article structure initially. Just pick something that you are very 
> familiar with or interested in and write.
>
> When you are done, submit a pull request on GitHub and someone from the 
> existing contributors team will
> suggest improvements or merge your work. Pretty straightforward.
>
> In order to make it easier for potential contributors to join the project, 
> we will post a brief list of
> guides that do not require deep expertise and can benefit from 
> contributions by complete beginners.
>
> ### Existing Guides
>
> Tutorials that badly need to be written:
>
>  * Tutorial on VimClojure [8]
>
> Guides that have structure and good chunk of the content in place but 
> still have holes you
> can help us plug:
>
>  * Java interop [5]
>  * Collections and Sequences [9]
>  * Namespaces [10]
>  * clojure.core Overview [11]
>
> These guides are new and cover advanced topics, so we need as much 
> proof-reading as we can
> get from the community:
>
>  * Concurrency and Parallelism in Clojure [1]
>
> ### New Content
>
> If you want to start working on one of those articles or have existing 
> content you've authored that can be ported,
> please let us know on the Clojure mailing list.
>
>
> ## Summary
>
> CDS is 2-3 guides from covering the language "reasonably well". There 
> still are holes in various guides
> but mostly in the more advanced areas and
>
> Want to help us make things better? Join us by forking and contributing to 
> http://github.com/clojuredocs/cds.
>
>
>
> 1. 
> http://clojure-doc.org/articles/language/concurrency_and_parallelism.html
>  2. http://clojure-doc.org/articles/tutorials/emacs.html
> 3. http://clojure-doc.org/articles/language/functions.html
> 4. http://clojure-doc.org/articles/language/core_overview.html
> 5. http://clojure-doc.org/articles/language/interop.html
> 6. http://clojure-doc.org/articles/ecosystem/community.html
> 7. http://github.com/clojuredocs/cds
> 8. http://clojure-doc.org/articles/tutorials/vim.html
> 9. http://clojure-doc.org/articles/language/sequences.html
> 10. http://clojure-doc.org/articles/language/namespaces.html
> 11. http://clojure-doc.org/articles/language/core_overview.html
>
>
> -- 
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
>

-- 
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 your 

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread titon barua
Very interesting read. Thanks for pointing out. :)

On Tuesday, October 30, 2012 2:04:39 PM UTC+6, Baishampayan Ghose wrote:
>
> Titon, 
>
> Not Clojure, but this blog series will give you an idea about how to 
> implement games of the Tetris sort in a FP language - 
>
> http://prog21.dadgum.com/23.html 
>
> Regards, 
> BG 
>
> On Tue, Oct 30, 2012 at 12:00 AM, titon barua 
> > 
> wrote: 
> > Hi, 
> > I am very new to Clojure and functional programming in general. I am 
> game 
> > development enthusiast(although did nothing more than a tetris clone in 
> > python and C). As far as i've seen OpenGL, it's mostly state 
> manipulation 
> > and seems to me like completely against Clojure's philosophy. Could 
> there 
> > exist some kind of magic that makes all the state manipulations 
> disappear? 
> > 
> > By the way, I think Clojure's concurrency capabilities can upsurge a new 
> era 
> > for game development as "GigaHertz war" have pretty much stopped and 
> game 
> > developers are  still reluctant to use full capabilities of multi-core 
> > hardware. Perhaps they didn't discover clojure yet? (: 
> > 
> > I for one would like some good and maintained wrappers for input and 
> > graphics in Clojure - like SDL and OpenGL. 
> > 
> > Disclaimer: I am a wannabe game dev chained to internet/web paradigm for 
> > financial reasons ... :( 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> > Note that posts from new members are moderated - please be patient with 
> your 
> > first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com  
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
>
>
>
> -- 
> Baishampayan Ghose 
> b.ghose at gmail.com 
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread Tim Olsen
I take it you are referring to the difference in capitalization.  I am
using java 1.7.0_07 on Mac OS X 10.7.5.

$ java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

On Tue, Oct 30, 2012 at 2:35 PM, JvJ  wrote:
> I executed the same test in java and got "infinity" as a result.  What
> version of the JDK are you using?  I'm using 1.7
>
>
> On Tuesday, 30 October 2012 11:10:17 UTC-4, Tim Olsen wrote:
>>
>> Hello Clojurians.
>>
>> Normally by some IEEE floating-point standard, division by 0.0 should
>> give Infinity (or NaN if the divisor is also 0.0).  This is the case
>> when using primitive doubles in clojure:
>>
>> (/ 1.0 0.0)
>> => Infinity
>>
>> And even when using boxed Doubles in java:
>>
>> public class BoxedDoubleDivideZero {
>>
>> public static void main(String[] args) {
>> Double a = new Double(4.0);
>> Double b = new Double(0.0);
>>
>> System.out.println(a/b);
>> }
>> }
>>
>> $ javac BoxedDoubleDivideZero.java
>> $ java BoxedDoubleDivideZero
>> Infinity
>>
>> But it is not the case when using boxed Doubles in clojure:
>>
>> (/ (Double. 1.0) (Double. 0.0))
>> ArithmeticException Divide by zero  clojure.lang.Numbers.divide
>> (Numbers.java:156)
>>
>> Is this considered a bug or feature?
>>
>> Thanks,
>> Tim
>
> --
> 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 your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread AtKaaZ
As I tested, looks like when either of the args are double ie. 1.0 instead
of 1
then the code that checks for and shows divide by zero is not reached,
which is this code:
static public Number divide(Object x, Object y){
Ops yops = ops(y);
if(yops.isZero((Number)y))
throw new ArithmeticException("Divide by zero");
return ops(x).combine(yops).divide((Number)x, (Number)y);
}



On Tue, Oct 30, 2012 at 3:52 PM, Tim Olsen  wrote:

> Hello Clojurians.
>
> Normally by some IEEE floating-point standard, division by 0.0 should
> give Infinity (or NaN if the divisor is also 0.0).  This is the case
> when using primitive doubles in clojure:
>
> (/ 1.0 0.0)
> => Infinity
>
> And even when using boxed Doubles in java:
>
> public class BoxedDoubleDivideZero {
>
> public static void main(String[] args) {
> Double a = new Double(4.0);
> Double b = new Double(0.0);
>
> System.out.println(a/b);
> }
> }
>
> $ javac BoxedDoubleDivideZero.java
> $ java BoxedDoubleDivideZero
> Infinity
>
> But it is not the case when using boxed Doubles in clojure:
>
> (/ (Double. 1.0) (Double. 0.0))
> ArithmeticException Divide by zero  clojure.lang.Numbers.divide
> (Numbers.java:156)
>
> Is this considered a bug or feature?
>
> Thanks,
> Tim
>
> --
> 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
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
I may be wrong or incomplete.
Please express any corrections / additions,
they are encouraged and appreciated.
At least one entity is bound to be transformed if you do ;)

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread AtKaaZ
Upon further research looks like:
=> *(/ 1 0.0)*
Infinity
triggers this method: clojure.lang.Numbers.*divide(long, double)*
*static public double divide(long x, double y){
return x / y;
}*


=>* (/ 1.0 0)*
Infinity
triggers this method: clojure.lang.Numbers.*divide(double, long)*
*static public double divide(double x, long y){
return x / y;
}*

=> *(/ 1 0)*
ArithmeticException Divide by zero  clojure.lang.Numbers.divide
(Numbers.java:157)
triggers this method: clojure.lang.Numbers.*divide(Object, Object)*
*static public Number divide(Object x, Object y){
Ops yops = ops(y);
if(yops.isZero((Number)y))
throw new ArithmeticException("Divide by zero");
return ops(x).combine(yops).divide((Number)x, (Number)y);
}*

On Tue, Oct 30, 2012 at 8:20 PM, AtKaaZ  wrote:

> As I tested, looks like when either of the args are double ie. 1.0 instead
> of 1
> then the code that checks for and shows divide by zero is not reached,
> which is this code:
> static public Number divide(Object x, Object y){
> Ops yops = ops(y);
> if(yops.isZero((Number)y))
> throw new ArithmeticException("Divide by zero");
> return ops(x).combine(yops).divide((Number)x, (Number)y);
>
> }
>
>
>
> On Tue, Oct 30, 2012 at 3:52 PM, Tim Olsen wrote:
>
>> Hello Clojurians.
>>
>> Normally by some IEEE floating-point standard, division by 0.0 should
>> give Infinity (or NaN if the divisor is also 0.0).  This is the case
>> when using primitive doubles in clojure:
>>
>> (/ 1.0 0.0)
>> => Infinity
>>
>> And even when using boxed Doubles in java:
>>
>> public class BoxedDoubleDivideZero {
>>
>> public static void main(String[] args) {
>> Double a = new Double(4.0);
>> Double b = new Double(0.0);
>>
>> System.out.println(a/b);
>> }
>> }
>>
>> $ javac BoxedDoubleDivideZero.java
>> $ java BoxedDoubleDivideZero
>> Infinity
>>
>> But it is not the case when using boxed Doubles in clojure:
>>
>> (/ (Double. 1.0) (Double. 0.0))
>> ArithmeticException Divide by zero  clojure.lang.Numbers.divide
>> (Numbers.java:156)
>>
>> Is this considered a bug or feature?
>>
>> Thanks,
>> Tim
>>
>> --
>> 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
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>
>
>
> --
> I may be wrong or incomplete.
> Please express any corrections / additions,
> they are encouraged and appreciated.
> At least one entity is bound to be transformed if you do ;)
>
>


-- 
I may be wrong or incomplete.
Please express any corrections / additions,
they are encouraged and appreciated.
At least one entity is bound to be transformed if you do ;)

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Build Issues with Eclipse

2012-10-30 Thread JvJ
I've resorted to explicitly calling compile from the REPLin CCW projects.  
It's not the best system, but it works.

On Tuesday, 30 October 2012 14:17:47 UTC-4, JvJ wrote:
>
> Thanks for this.  I think I'm getting somewhere, but I'm still having some 
> problems.
>
> I'm trying to use lein-localdeps.  I seem to have been able to install the 
> jar to my local repository, but when I run lein deps it says it can't find 
> it.
> Also, I have some native dependencies that aren't being installed.
>
> Any ideas?
>
> On Monday, 29 October 2012 20:17:45 UTC-4, David McNeil wrote:
>>
>> Does this thread address your need?
>>
>>
>> https://groups.google.com/forum/?fromgroups=#!searchin/clojure/local$20repository$20/clojure/1Ne8RqiffVI/aGoCPWiiCakJ
>>
>> -David
>
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread Mark Neyer
i'm trying to get a graph database running on my machine, and when i run 
lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing this:


[INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:jar:2.1.12' in 
repository ghelmling.testing (http://people.apache.org/~garyh/mvn/)
Downloading: com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar from repository 
m1.dev.java.net at http://download.java.net/maven/1
Transferring 847K from m1.dev.java.net
Copying 91 files to /home/mark/gc/src/titan-test-case/lib
Exception in thread "main" java.lang.RuntimeException: 
java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5441)
at clojure.lang.Compiler.eval(Compiler.java:5392)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error in 
opening zip file
at clojure.lang.LazySeq.sval(LazySeq.java:47)
at clojure.lang.LazySeq.seq(LazySeq.java:56)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.next(RT.java:560)
at clojure.core$next.invoke(core.clj:61)
at leiningen.deps$extract_native_deps.invoke(deps.clj:174)
at leiningen.deps$deps.doInvoke(deps.clj:200)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at leiningen.compile$prep.invoke(compile.clj:150)
at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at leiningen.compile$compile.invoke(compile.clj:283)
at leiningen.compile$prep$fn__2010.invoke(compile.clj:148)
at leiningen.compile$prep.invoke(compile.clj:147)
at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
at clojure.lang.RestFn.invoke(RestFn.java:490)
at leiningen.run$run_main.doInvoke(run.clj:26)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:544)
at leiningen.run$run.doInvoke(run.clj:57)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:262)
at leiningen.core$_main.doInvoke(core.clj:329)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval42.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5425)
... 11 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:214)
at java.util.zip.ZipFile.(ZipFile.java:144)
at java.util.jar.JarFile.(JarFile.java:152)
at java.util.jar.JarFile.(JarFile.java:116)
at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown 
Source)
at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at clojure.lang.Reflector.invokeConstructor(Reflector.java:160)
at leiningen.deps$extract_native_deps$fn__2449.invoke(deps.clj:174)
at clojure.core$map$fn__3699.invoke(core.clj:2096)
at clojure.lang.LazySeq.sval(LazySeq.java:42)



i saw this same error (trying to unzip a nonexistent file) once before, and 
it was caused by the repository giving a redirect. lein the http redirect 
response instead of fetching the file from the new location.  i fixed it 
then by changing all respositories in project.clj to use https, but that's 
doing no good here.

here's my project.clj


(defproject titan-test-case "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME";
  :license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
  :main titan-test-case.core
  :repositories [["typesafe" 
"https://repo.typesafe.com/typesafe/snapshots/";]
 ["apache" 
"https://repository.apache.org/cont

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread Marcus Magnusson
This article might be of interest:

http://clojurefun.wordpress.com/2012/09/03/ironclad-steam-legions-clojure-game-development-battle-report/


I haven't had much experience with game development in Clojure myself, 
although one of the first real projects I made with Clojure was a simple 
Tetris clone. Having done a Tetris clone in C++ some years earlier, I was 
-shocked- at how easy it was in Clojure to model the game in an 
easy-to-understand, easy-to-process way. Have been hoping to take the time 
to do something a little more involved, but that'll have to wait - you make 
sure to share your experiences if you go any further, though!



On Tuesday, October 30, 2012 8:00:07 AM UTC+1, titon barua wrote:
>
> Hi,
> I am very new to Clojure and functional programming in general. I am game 
> development enthusiast(although did nothing more than a tetris clone in 
> python and C). As far as i've seen OpenGL, it's mostly state manipulation 
> and seems to me like completely against Clojure's philosophy. Could there 
> exist some kind of magic that makes all the state manipulations disappear?
>
> By the way, I think Clojure's concurrency capabilities can upsurge a new 
> era for game development as "GigaHertz war" have pretty much stopped and 
> game developers are  still reluctant to use full capabilities of multi-core 
> hardware. Perhaps they didn't discover clojure yet? (:
>
> I for one would like some good and maintained wrappers for input and 
> graphics in Clojure - like SDL and OpenGL.
>
> Disclaimer: I am a wannabe game dev chained to internet/web paradigm for 
> financial reasons ... :(
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread AtKaaZ
Maybe try creating ~/.m2

On Tue, Oct 30, 2012 at 9:23 PM, Mark Neyer  wrote:

> i'm trying to get a graph database running on my machine, and when i run
> lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing this:
>
>
> [INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:jar:2.1.12' in
> repository ghelmling.testing (http://people.apache.org/~garyh/mvn/)
> Downloading: com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar from repository
> m1.dev.java.net at http://download.java.net/maven/1
> Transferring 847K from m1.dev.java.net
> Copying 91 files to /home/mark/gc/src/titan-test-case/lib
> Exception in thread "main" java.lang.RuntimeException:
> java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
> at clojure.lang.Compiler.eval(Compiler.java:5441)
> at clojure.lang.Compiler.eval(Compiler.java:5392)
> at clojure.core$eval.invoke(core.clj:2382)
> at clojure.main$eval_opt.invoke(main.clj:235)
> at clojure.main$initialize.invoke(main.clj:254)
> at clojure.main$script_opt.invoke(main.clj:270)
> at clojure.main$main.doInvoke(main.clj:354)
> at clojure.lang.RestFn.invoke(RestFn.java:457)
> at clojure.lang.Var.invoke(Var.java:377)
> at clojure.lang.AFn.applyToHelper(AFn.java:172)
> at clojure.lang.Var.applyTo(Var.java:482)
> at clojure.main.main(main.java:37)
> Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error
> in opening zip file
> at clojure.lang.LazySeq.sval(LazySeq.java:47)
> at clojure.lang.LazySeq.seq(LazySeq.java:56)
> at clojure.lang.Cons.next(Cons.java:39)
> at clojure.lang.RT.next(RT.java:560)
> at clojure.core$next.invoke(core.clj:61)
> at leiningen.deps$extract_native_deps.invoke(deps.clj:174)
> at leiningen.deps$deps.doInvoke(deps.clj:200)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at leiningen.compile$prep.invoke(compile.clj:150)
> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
> at clojure.lang.RestFn.invoke(RestFn.java:425)
> at leiningen.compile$compile.invoke(compile.clj:283)
> at leiningen.compile$prep$fn__2010.invoke(compile.clj:148)
> at leiningen.compile$prep.invoke(compile.clj:147)
> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
> at clojure.lang.RestFn.invoke(RestFn.java:490)
> at leiningen.run$run_main.doInvoke(run.clj:26)
> at clojure.lang.RestFn.invoke(RestFn.java:425)
> at clojure.lang.AFn.applyToHelper(AFn.java:163)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:544)
> at leiningen.run$run.doInvoke(run.clj:57)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.Var.invoke(Var.java:365)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.Var.applyTo(Var.java:482)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$apply_task.invoke(core.clj:262)
> at leiningen.core$_main.doInvoke(core.clj:329)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$_main.invoke(core.clj:332)
> at user$eval42.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:5425)
> ... 11 more
> Caused by: java.util.zip.ZipException: error in opening zip file
> at java.util.zip.ZipFile.open(Native Method)
> at java.util.zip.ZipFile.(ZipFile.java:214)
> at java.util.zip.ZipFile.(ZipFile.java:144)
> at java.util.jar.JarFile.(JarFile.java:152)
> at java.util.jar.JarFile.(JarFile.java:116)
> at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown
> Source)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
> at clojure.lang.Reflector.invokeConstructor(Reflector.java:160)
> at leiningen.deps$extract_native_deps$fn__2449.invoke(deps.clj:174)
> at clojure.core$map$fn__3699.invoke(core.clj:2096)
> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>
>
>
> i saw this same error (trying to unzip a nonexistent file) once before,
> and it was caused by the repository giving a redirect. lein the http
> redirect response instead of fetching the file from the new location.  i
> fixed it then by changing all respositories in project.clj to use https,
> but that's doing no good here.
>
> here's my project.clj
>
>
> (defproject titan-test-case "0.1.0-SNAPSHOT"
>   :description "FIXME: write description"
>   :url "http://example.com/FIXME";
>   :license {:name "Eclipse Pu

Re: lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread Mark Neyer
nope, same problem. i didn't post the entire console log spam before it 
crashes; it successfully gets a bunch of libraries, but seems to get stuck 
on jetty/servlet-api - and it always appears to get stuck there.

is there any way i can see what zip file it was trying to open?

On Tuesday, October 30, 2012 1:33:37 PM UTC-7, AtKaaZ wrote:
>
> Maybe try creating ~/.m2
>
> On Tue, Oct 30, 2012 at 9:23 PM, Mark Neyer 
> > wrote:
>
>> i'm trying to get a graph database running on my machine, and when i run 
>> lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing this:
>>
>>
>> [INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:jar:2.1.12' in 
>> repository ghelmling.testing (http://people.apache.org/~garyh/mvn/)
>> Downloading: com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar from repository 
>> m1.dev.java.net at http://download.java.net/maven/1
>> Transferring 847K from m1.dev.java.net
>> Copying 91 files to /home/mark/gc/src/titan-test-case/lib
>> Exception in thread "main" java.lang.RuntimeException: 
>> java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
>> at clojure.lang.Compiler.eval(Compiler.java:5441)
>> at clojure.lang.Compiler.eval(Compiler.java:5392)
>> at clojure.core$eval.invoke(core.clj:2382)
>> at clojure.main$eval_opt.invoke(main.clj:235)
>> at clojure.main$initialize.invoke(main.clj:254)
>> at clojure.main$script_opt.invoke(main.clj:270)
>> at clojure.main$main.doInvoke(main.clj:354)
>> at clojure.lang.RestFn.invoke(RestFn.java:457)
>> at clojure.lang.Var.invoke(Var.java:377)
>> at clojure.lang.AFn.applyToHelper(AFn.java:172)
>> at clojure.lang.Var.applyTo(Var.java:482)
>> at clojure.main.main(main.java:37)
>> Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error 
>> in opening zip file
>> at clojure.lang.LazySeq.sval(LazySeq.java:47)
>> at clojure.lang.LazySeq.seq(LazySeq.java:56)
>> at clojure.lang.Cons.next(Cons.java:39)
>> at clojure.lang.RT.next(RT.java:560)
>> at clojure.core$next.invoke(core.clj:61)
>> at leiningen.deps$extract_native_deps.invoke(deps.clj:174)
>> at leiningen.deps$deps.doInvoke(deps.clj:200)
>> at clojure.lang.RestFn.invoke(RestFn.java:410)
>> at leiningen.compile$prep.invoke(compile.clj:150)
>> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
>> at clojure.lang.RestFn.invoke(RestFn.java:425)
>> at leiningen.compile$compile.invoke(compile.clj:283)
>> at leiningen.compile$prep$fn__2010.invoke(compile.clj:148)
>> at leiningen.compile$prep.invoke(compile.clj:147)
>> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
>> at clojure.lang.RestFn.invoke(RestFn.java:490)
>> at leiningen.run$run_main.doInvoke(run.clj:26)
>> at clojure.lang.RestFn.invoke(RestFn.java:425)
>> at clojure.lang.AFn.applyToHelper(AFn.java:163)
>> at clojure.lang.RestFn.applyTo(RestFn.java:132)
>> at clojure.core$apply.invoke(core.clj:544)
>> at leiningen.run$run.doInvoke(run.clj:57)
>> at clojure.lang.RestFn.invoke(RestFn.java:410)
>> at clojure.lang.Var.invoke(Var.java:365)
>> at clojure.lang.AFn.applyToHelper(AFn.java:161)
>> at clojure.lang.Var.applyTo(Var.java:482)
>> at clojure.core$apply.invoke(core.clj:542)
>> at leiningen.core$apply_task.invoke(core.clj:262)
>> at leiningen.core$_main.doInvoke(core.clj:329)
>> at clojure.lang.RestFn.invoke(RestFn.java:410)
>> at clojure.lang.AFn.applyToHelper(AFn.java:161)
>> at clojure.lang.RestFn.applyTo(RestFn.java:132)
>> at clojure.core$apply.invoke(core.clj:542)
>> at leiningen.core$_main.invoke(core.clj:332)
>> at user$eval42.invoke(NO_SOURCE_FILE:1)
>> at clojure.lang.Compiler.eval(Compiler.java:5425)
>> ... 11 more
>> Caused by: java.util.zip.ZipException: error in opening zip file
>> at java.util.zip.ZipFile.open(Native Method)
>> at java.util.zip.ZipFile.(ZipFile.java:214)
>> at java.util.zip.ZipFile.(ZipFile.java:144)
>> at java.util.jar.JarFile.(JarFile.java:152)
>> at java.util.jar.JarFile.(JarFile.java:116)
>> at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown 
>> Source)
>> at 
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
>> at clojure.lang.Reflector.invokeConstructor(Reflector.java:160)
>> at 
>> leiningen.deps$extract_native_deps$fn__2449.invoke(deps.clj:174)
>> at clojure.core$map$fn__3699.invoke(core.clj:2096)
>> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>>
>>
>>
>> i saw this same error (trying to unzip a nonexistent file) once befor

Re: lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread AtKaaZ
I cannot access http://m1.dev.java.net/  I'm getting server not found.
Maybe it's unrelated.
But the zip file is a .jar file, it's possible it's either 0 bytes or
incomplete - my guess.
you can set env var DEBUG to y  so lein will spit more info


On Tue, Oct 30, 2012 at 9:55 PM, Mark Neyer  wrote:

> nope, same problem. i didn't post the entire console log spam before it
> crashes; it successfully gets a bunch of libraries, but seems to get stuck
> on jetty/servlet-api - and it always appears to get stuck there.
>
> is there any way i can see what zip file it was trying to open?
>
> On Tuesday, October 30, 2012 1:33:37 PM UTC-7, AtKaaZ wrote:
>
>> Maybe try creating ~/.m2
>>
>> On Tue, Oct 30, 2012 at 9:23 PM, Mark Neyer  wrote:
>>
>>> i'm trying to get a graph database running on my machine, and when i run
>>> lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing this:
>>>
>>>
>>> [INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:**jar:2.1.12'
>>> in repository ghelmling.testing 
>>> (http://people.apache.org/~**garyh/mvn/
>>> )
>>> Downloading: com.sun.xml.bind/jars/jaxb-**impl-2.1.12.jar from
>>> repository m1.dev.java.net at 
>>> http://download.java.net/**maven/1
>>> Transferring 847K from m1.dev.java.net
>>> Copying 91 files to /home/mark/gc/src/titan-test-**case/lib
>>> Exception in thread "main" java.lang.RuntimeException:
>>> java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
>>> at clojure.lang.Compiler.eval(**Compiler.java:5441)
>>> at clojure.lang.Compiler.eval(**Compiler.java:5392)
>>> at clojure.core$eval.invoke(core.**clj:2382)
>>> at clojure.main$eval_opt.invoke(**main.clj:235)
>>> at clojure.main$initialize.**invoke(main.clj:254)
>>> at clojure.main$script_opt.**invoke(main.clj:270)
>>> at clojure.main$main.doInvoke(**main.clj:354)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:457)
>>> at clojure.lang.Var.invoke(Var.**java:377)
>>> at clojure.lang.AFn.**applyToHelper(AFn.java:172)
>>> at clojure.lang.Var.applyTo(Var.**java:482)
>>> at clojure.main.main(main.java:**37)
>>> Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error
>>> in opening zip file
>>> at clojure.lang.LazySeq.sval(**LazySeq.java:47)
>>> at clojure.lang.LazySeq.seq(**LazySeq.java:56)
>>> at clojure.lang.Cons.next(Cons.**java:39)
>>> at clojure.lang.RT.next(RT.java:**560)
>>> at clojure.core$next.invoke(core.**clj:61)
>>> at leiningen.deps$extract_native_**deps.invoke(deps.clj:174)
>>> at leiningen.deps$deps.doInvoke(**deps.clj:200)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:410)
>>> at leiningen.compile$prep.invoke(**compile.clj:150)
>>> at leiningen.compile$eval_in_**project.doInvoke(compile.clj:**
>>> 207)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:425)
>>> at leiningen.compile$compile.**invoke(compile.clj:283)
>>> at leiningen.compile$prep$fn__**2010.invoke(compile.clj:148)
>>> at leiningen.compile$prep.invoke(**compile.clj:147)
>>> at leiningen.compile$eval_in_**project.doInvoke(compile.clj:**
>>> 207)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:490)
>>> at leiningen.run$run_main.**doInvoke(run.clj:26)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:425)
>>> at clojure.lang.AFn.**applyToHelper(AFn.java:163)
>>> at clojure.lang.RestFn.applyTo(**RestFn.java:132)
>>> at clojure.core$apply.invoke(**core.clj:544)
>>> at leiningen.run$run.doInvoke(**run.clj:57)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:410)
>>> at clojure.lang.Var.invoke(Var.**java:365)
>>> at clojure.lang.AFn.**applyToHelper(AFn.java:161)
>>> at clojure.lang.Var.applyTo(Var.**java:482)
>>> at clojure.core$apply.invoke(**core.clj:542)
>>> at leiningen.core$apply_task.**invoke(core.clj:262)
>>> at leiningen.core$_main.doInvoke(**core.clj:329)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:410)
>>> at clojure.lang.AFn.**applyToHelper(AFn.java:161)
>>> at clojure.lang.RestFn.applyTo(**RestFn.java:132)
>>> at clojure.core$apply.invoke(**core.clj:542)
>>> at leiningen.core$_main.invoke(**core.clj:332)
>>> at user$eval42.invoke(NO_SOURCE_**FILE:1)
>>> at clojure.lang.Compiler.eval(**Compiler.java:5425)
>>> ... 11 more
>>> Caused by: java.util.zip.ZipException: error in opening zip file
>>> at java.util.zip.ZipFile.open(**Native Method)
>>> at java.util.zip.ZipFile.(**ZipFile.java:214)
>>> at java.util.zip.ZipFile.(**ZipFile.java:144)
>>> at java.util.jar.JarFile.(**JarFile.java:152)
>>> at java.util.jar.JarFile.(**JarFile.java:116)
>>> at 
>>> sun.reflect.**GeneratedConstruct

Re: lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread AtKaaZ
On Tue, Oct 30, 2012 at 9:57 PM, AtKaaZ  wrote:

> I cannot access http://m1.dev.java.net/  I'm getting server not found.
> Maybe it's unrelated.
>
oh i see that this is the repo name, my bad.


> But the zip file is a .jar file, it's possible it's either 0 bytes or
> incomplete - my guess.
> you can set env var DEBUG to y  so lein will spit more info
>
>
>
> On Tue, Oct 30, 2012 at 9:55 PM, Mark Neyer  wrote:
>
>> nope, same problem. i didn't post the entire console log spam before it
>> crashes; it successfully gets a bunch of libraries, but seems to get stuck
>> on jetty/servlet-api - and it always appears to get stuck there.
>>
>> is there any way i can see what zip file it was trying to open?
>>
>> On Tuesday, October 30, 2012 1:33:37 PM UTC-7, AtKaaZ wrote:
>>
>>> Maybe try creating ~/.m2
>>>
>>> On Tue, Oct 30, 2012 at 9:23 PM, Mark Neyer  wrote:
>>>
  i'm trying to get a graph database running on my machine, and when i
 run lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing
 this:


 [INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:**jar:2.1.12'
 in repository ghelmling.testing 
 (http://people.apache.org/~**garyh/mvn/
 )
 Downloading: com.sun.xml.bind/jars/jaxb-**impl-2.1.12.jar from
 repository m1.dev.java.net at 
 http://download.java.net/**maven/1
 Transferring 847K from m1.dev.java.net
 Copying 91 files to /home/mark/gc/src/titan-test-**case/lib
 Exception in thread "main" java.lang.RuntimeException:
 java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
 at clojure.lang.Compiler.eval(**Compiler.java:5441)
 at clojure.lang.Compiler.eval(**Compiler.java:5392)
 at clojure.core$eval.invoke(core.**clj:2382)
 at clojure.main$eval_opt.invoke(**main.clj:235)
 at clojure.main$initialize.**invoke(main.clj:254)
 at clojure.main$script_opt.**invoke(main.clj:270)
 at clojure.main$main.doInvoke(**main.clj:354)
 at clojure.lang.RestFn.invoke(**RestFn.java:457)
 at clojure.lang.Var.invoke(Var.**java:377)
 at clojure.lang.AFn.**applyToHelper(AFn.java:172)
 at clojure.lang.Var.applyTo(Var.**java:482)
 at clojure.main.main(main.java:**37)
 Caused by: java.lang.RuntimeException: java.util.zip.ZipException:
 error in opening zip file
 at clojure.lang.LazySeq.sval(**LazySeq.java:47)
 at clojure.lang.LazySeq.seq(**LazySeq.java:56)
 at clojure.lang.Cons.next(Cons.**java:39)
 at clojure.lang.RT.next(RT.java:**560)
 at clojure.core$next.invoke(core.**clj:61)
 at leiningen.deps$extract_native_**deps.invoke(deps.clj:174)
 at leiningen.deps$deps.doInvoke(**deps.clj:200)
 at clojure.lang.RestFn.invoke(**RestFn.java:410)
 at leiningen.compile$prep.invoke(**compile.clj:150)
 at leiningen.compile$eval_in_**project.doInvoke(compile.clj:**
 207)
 at clojure.lang.RestFn.invoke(**RestFn.java:425)
 at leiningen.compile$compile.**invoke(compile.clj:283)
 at leiningen.compile$prep$fn__**2010.invoke(compile.clj:148)
 at leiningen.compile$prep.invoke(**compile.clj:147)
 at leiningen.compile$eval_in_**project.doInvoke(compile.clj:**
 207)
 at clojure.lang.RestFn.invoke(**RestFn.java:490)
 at leiningen.run$run_main.**doInvoke(run.clj:26)
 at clojure.lang.RestFn.invoke(**RestFn.java:425)
 at clojure.lang.AFn.**applyToHelper(AFn.java:163)
 at clojure.lang.RestFn.applyTo(**RestFn.java:132)
 at clojure.core$apply.invoke(**core.clj:544)
 at leiningen.run$run.doInvoke(**run.clj:57)
 at clojure.lang.RestFn.invoke(**RestFn.java:410)
 at clojure.lang.Var.invoke(Var.**java:365)
 at clojure.lang.AFn.**applyToHelper(AFn.java:161)
 at clojure.lang.Var.applyTo(Var.**java:482)
 at clojure.core$apply.invoke(**core.clj:542)
 at leiningen.core$apply_task.**invoke(core.clj:262)
 at leiningen.core$_main.doInvoke(**core.clj:329)
 at clojure.lang.RestFn.invoke(**RestFn.java:410)
 at clojure.lang.AFn.**applyToHelper(AFn.java:161)
 at clojure.lang.RestFn.applyTo(**RestFn.java:132)
 at clojure.core$apply.invoke(**core.clj:542)
 at leiningen.core$_main.invoke(**core.clj:332)
 at user$eval42.invoke(NO_SOURCE_**FILE:1)
 at clojure.lang.Compiler.eval(**Compiler.java:5425)
 ... 11 more
 Caused by: java.util.zip.ZipException: error in opening zip file
 at java.util.zip.ZipFile.open(**Native Method)
 at java.util.zip.ZipFile.(**ZipFile.java:214)
 at java.u

Re: lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread AtKaaZ
Someone said this
"

I solved this by clearing the jboss-x.y.z/server[config]/tmp and
jboss-x.y.z/server/[config]/work directories.

"

Not sure if this at all applies to you


On Tue, Oct 30, 2012 at 9:58 PM, AtKaaZ  wrote:

>
>
> On Tue, Oct 30, 2012 at 9:57 PM, AtKaaZ  wrote:
>
>> I cannot access http://m1.dev.java.net/  I'm getting server not found.
>> Maybe it's unrelated.
>>
> oh i see that this is the repo name, my bad.
>
>
>> But the zip file is a .jar file, it's possible it's either 0 bytes or
>> incomplete - my guess.
>> you can set env var DEBUG to y  so lein will spit more info
>>
>>
>>
>> On Tue, Oct 30, 2012 at 9:55 PM, Mark Neyer  wrote:
>>
>>> nope, same problem. i didn't post the entire console log spam before it
>>> crashes; it successfully gets a bunch of libraries, but seems to get stuck
>>> on jetty/servlet-api - and it always appears to get stuck there.
>>>
>>> is there any way i can see what zip file it was trying to open?
>>>
>>> On Tuesday, October 30, 2012 1:33:37 PM UTC-7, AtKaaZ wrote:
>>>
 Maybe try creating ~/.m2

 On Tue, Oct 30, 2012 at 9:23 PM, Mark Neyer  wrote:

>  i'm trying to get a graph database running on my machine, and when i
> run lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing
> this:
>
>
> [INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:**jar:2.1.12'
> in repository ghelmling.testing (http://people.apache.org/~**
> garyh/mvn/ )
> Downloading: com.sun.xml.bind/jars/jaxb-**impl-2.1.12.jar from
> repository m1.dev.java.net at 
> http://download.java.net/**maven/1
> Transferring 847K from m1.dev.java.net
> Copying 91 files to /home/mark/gc/src/titan-test-**case/lib
> Exception in thread "main" java.lang.RuntimeException:
> java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
> at clojure.lang.Compiler.eval(**Compiler.java:5441)
> at clojure.lang.Compiler.eval(**Compiler.java:5392)
> at clojure.core$eval.invoke(core.**clj:2382)
> at clojure.main$eval_opt.invoke(**main.clj:235)
> at clojure.main$initialize.**invoke(main.clj:254)
> at clojure.main$script_opt.**invoke(main.clj:270)
> at clojure.main$main.doInvoke(**main.clj:354)
> at clojure.lang.RestFn.invoke(**RestFn.java:457)
> at clojure.lang.Var.invoke(Var.**java:377)
> at clojure.lang.AFn.**applyToHelper(AFn.java:172)
> at clojure.lang.Var.applyTo(Var.**java:482)
> at clojure.main.main(main.java:**37)
> Caused by: java.lang.RuntimeException: java.util.zip.ZipException:
> error in opening zip file
> at clojure.lang.LazySeq.sval(**LazySeq.java:47)
> at clojure.lang.LazySeq.seq(**LazySeq.java:56)
> at clojure.lang.Cons.next(Cons.**java:39)
> at clojure.lang.RT.next(RT.java:**560)
> at clojure.core$next.invoke(core.**clj:61)
> at leiningen.deps$extract_native_**deps.invoke(deps.clj:174)
> at leiningen.deps$deps.doInvoke(**deps.clj:200)
> at clojure.lang.RestFn.invoke(**RestFn.java:410)
> at leiningen.compile$prep.invoke(**compile.clj:150)
> at leiningen.compile$eval_in_**project.doInvoke(compile.clj:**
> 207)
> at clojure.lang.RestFn.invoke(**RestFn.java:425)
> at leiningen.compile$compile.**invoke(compile.clj:283)
> at leiningen.compile$prep$fn__**2010.invoke(compile.clj:148)
> at leiningen.compile$prep.invoke(**compile.clj:147)
> at leiningen.compile$eval_in_**project.doInvoke(compile.clj:**
> 207)
> at clojure.lang.RestFn.invoke(**RestFn.java:490)
> at leiningen.run$run_main.**doInvoke(run.clj:26)
> at clojure.lang.RestFn.invoke(**RestFn.java:425)
> at clojure.lang.AFn.**applyToHelper(AFn.java:163)
> at clojure.lang.RestFn.applyTo(**RestFn.java:132)
> at clojure.core$apply.invoke(**core.clj:544)
> at leiningen.run$run.doInvoke(**run.clj:57)
> at clojure.lang.RestFn.invoke(**RestFn.java:410)
> at clojure.lang.Var.invoke(Var.**java:365)
> at clojure.lang.AFn.**applyToHelper(AFn.java:161)
> at clojure.lang.Var.applyTo(Var.**java:482)
> at clojure.core$apply.invoke(**core.clj:542)
> at leiningen.core$apply_task.**invoke(core.clj:262)
> at leiningen.core$_main.doInvoke(**core.clj:329)
> at clojure.lang.RestFn.invoke(**RestFn.java:410)
> at clojure.lang.AFn.**applyToHelper(AFn.java:161)
> at clojure.lang.RestFn.applyTo(**RestFn.java:132)
> at clojure.core$apply.invoke(**core.clj:542)
> at leiningen.core$_main.invoke(**core.clj:332)
> at user$eval42.invoke(

Re: lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread AtKaaZ
Using your provided project.clj
and lein2 from master
I was able to successfully run lein deps


Here's a part of the output:
...
Retrieving org/mortbay/jetty/jsp-api-2.1/6.1.14/jsp-api-2.1-6.1.14.jar
(132k) fr
om central
Retrieving org/mortbay/*jetty/servlet-api*-2.5/6.1.14/servlet-api-2.5-6.1.14.jar
(
129k) from central
Retrieving org/codehaus/jackson/jackson-jaxrs/1.5.5/jackson-jaxrs-1.5.5.jar
(17k
) from central



On Tue, Oct 30, 2012 at 9:23 PM, Mark Neyer  wrote:

> i'm trying to get a graph database running on my machine, and when i run
> lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing this:
>
>
> [INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:jar:2.1.12' in
> repository ghelmling.testing (http://people.apache.org/~garyh/mvn/)
> Downloading: com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar from repository
> m1.dev.java.net at http://download.java.net/maven/1
> Transferring 847K from m1.dev.java.net
> Copying 91 files to /home/mark/gc/src/titan-test-case/lib
> Exception in thread "main" java.lang.RuntimeException:
> java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
> at clojure.lang.Compiler.eval(Compiler.java:5441)
> at clojure.lang.Compiler.eval(Compiler.java:5392)
> at clojure.core$eval.invoke(core.clj:2382)
> at clojure.main$eval_opt.invoke(main.clj:235)
> at clojure.main$initialize.invoke(main.clj:254)
> at clojure.main$script_opt.invoke(main.clj:270)
> at clojure.main$main.doInvoke(main.clj:354)
> at clojure.lang.RestFn.invoke(RestFn.java:457)
> at clojure.lang.Var.invoke(Var.java:377)
> at clojure.lang.AFn.applyToHelper(AFn.java:172)
> at clojure.lang.Var.applyTo(Var.java:482)
> at clojure.main.main(main.java:37)
> Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error
> in opening zip file
> at clojure.lang.LazySeq.sval(LazySeq.java:47)
> at clojure.lang.LazySeq.seq(LazySeq.java:56)
> at clojure.lang.Cons.next(Cons.java:39)
> at clojure.lang.RT.next(RT.java:560)
> at clojure.core$next.invoke(core.clj:61)
> at leiningen.deps$extract_native_deps.invoke(deps.clj:174)
> at leiningen.deps$deps.doInvoke(deps.clj:200)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at leiningen.compile$prep.invoke(compile.clj:150)
> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
> at clojure.lang.RestFn.invoke(RestFn.java:425)
> at leiningen.compile$compile.invoke(compile.clj:283)
> at leiningen.compile$prep$fn__2010.invoke(compile.clj:148)
> at leiningen.compile$prep.invoke(compile.clj:147)
> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
> at clojure.lang.RestFn.invoke(RestFn.java:490)
> at leiningen.run$run_main.doInvoke(run.clj:26)
> at clojure.lang.RestFn.invoke(RestFn.java:425)
> at clojure.lang.AFn.applyToHelper(AFn.java:163)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:544)
> at leiningen.run$run.doInvoke(run.clj:57)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.Var.invoke(Var.java:365)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.Var.applyTo(Var.java:482)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$apply_task.invoke(core.clj:262)
> at leiningen.core$_main.doInvoke(core.clj:329)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$_main.invoke(core.clj:332)
> at user$eval42.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:5425)
> ... 11 more
> Caused by: java.util.zip.ZipException: error in opening zip file
> at java.util.zip.ZipFile.open(Native Method)
> at java.util.zip.ZipFile.(ZipFile.java:214)
> at java.util.zip.ZipFile.(ZipFile.java:144)
> at java.util.jar.JarFile.(JarFile.java:152)
> at java.util.jar.JarFile.(JarFile.java:116)
> at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown
> Source)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
> at clojure.lang.Reflector.invokeConstructor(Reflector.java:160)
> at leiningen.deps$extract_native_deps$fn__2449.invoke(deps.clj:174)
> at clojure.core$map$fn__3699.invoke(core.clj:2096)
> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>
>
>
> i saw this same error (trying to unzip a nonexistent file) once before,
> and it was caused by the repository givi

Re: lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread AtKaaZ
How come you got this message?
*Copying 91 files to /home/mark/gc/src/titan-test-**case/lib*

Did you use a different project.clj which has

:native-path

?
Because it seems it's happening when trying to extract the native deps from
a jar into the lib folder in your project.
I tried adding :native-path "lib"
but nothing happens (no lib folder gets created)
Oh wait, are you using lein1 ?

On Tue, Oct 30, 2012 at 9:23 PM, Mark Neyer  wrote:

> i'm trying to get a graph database running on my machine, and when i run
> lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing this:
>
>
> [INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:jar:2.1.12' in
> repository ghelmling.testing (http://people.apache.org/~garyh/mvn/)
> Downloading: com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar from repository
> m1.dev.java.net at http://download.java.net/maven/1
> Transferring 847K from m1.dev.java.net
> Copying 91 files to /home/mark/gc/src/titan-test-case/lib
> Exception in thread "main" java.lang.RuntimeException:
> java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
> at clojure.lang.Compiler.eval(Compiler.java:5441)
> at clojure.lang.Compiler.eval(Compiler.java:5392)
> at clojure.core$eval.invoke(core.clj:2382)
> at clojure.main$eval_opt.invoke(main.clj:235)
> at clojure.main$initialize.invoke(main.clj:254)
> at clojure.main$script_opt.invoke(main.clj:270)
> at clojure.main$main.doInvoke(main.clj:354)
> at clojure.lang.RestFn.invoke(RestFn.java:457)
> at clojure.lang.Var.invoke(Var.java:377)
> at clojure.lang.AFn.applyToHelper(AFn.java:172)
> at clojure.lang.Var.applyTo(Var.java:482)
> at clojure.main.main(main.java:37)
> Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error
> in opening zip file
> at clojure.lang.LazySeq.sval(LazySeq.java:47)
> at clojure.lang.LazySeq.seq(LazySeq.java:56)
> at clojure.lang.Cons.next(Cons.java:39)
> at clojure.lang.RT.next(RT.java:560)
> at clojure.core$next.invoke(core.clj:61)
> at leiningen.deps$extract_native_deps.invoke(deps.clj:174)
> at leiningen.deps$deps.doInvoke(deps.clj:200)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at leiningen.compile$prep.invoke(compile.clj:150)
> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
> at clojure.lang.RestFn.invoke(RestFn.java:425)
> at leiningen.compile$compile.invoke(compile.clj:283)
> at leiningen.compile$prep$fn__2010.invoke(compile.clj:148)
> at leiningen.compile$prep.invoke(compile.clj:147)
> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
> at clojure.lang.RestFn.invoke(RestFn.java:490)
> at leiningen.run$run_main.doInvoke(run.clj:26)
> at clojure.lang.RestFn.invoke(RestFn.java:425)
> at clojure.lang.AFn.applyToHelper(AFn.java:163)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:544)
> at leiningen.run$run.doInvoke(run.clj:57)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.Var.invoke(Var.java:365)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.Var.applyTo(Var.java:482)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$apply_task.invoke(core.clj:262)
> at leiningen.core$_main.doInvoke(core.clj:329)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$_main.invoke(core.clj:332)
> at user$eval42.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:5425)
> ... 11 more
> Caused by: java.util.zip.ZipException: error in opening zip file
> at java.util.zip.ZipFile.open(Native Method)
> at java.util.zip.ZipFile.(ZipFile.java:214)
> at java.util.zip.ZipFile.(ZipFile.java:144)
> at java.util.jar.JarFile.(JarFile.java:152)
> at java.util.jar.JarFile.(JarFile.java:116)
> at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown
> Source)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
> at clojure.lang.Reflector.invokeConstructor(Reflector.java:160)
> at leiningen.deps$extract_native_deps$fn__2449.invoke(deps.clj:174)
> at clojure.core$map$fn__3699.invoke(core.clj:2096)
> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>
>
>
> i saw this same error (trying to unzip a nonexistent file) once before,
> and it was caused by the repository giving a redirect. lein the http
> redir

About code help: is it ok to ask for how to improve?

2012-10-30 Thread Sean S
Extremely new to clojure, so most of what I write feels really cumbersome. 
Was curious is I'm allowed to post code to get opinions on.

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: About code help: is it ok to ask for how to improve?

2012-10-30 Thread nicolas.o...@gmail.com
I would think so.

But to maximise your chances of getting useful help, it is often
better to post small pieces of codes and explain what
you are trying to achieve with them.

Best,

Nicolas.

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: lein deps fails with java.util.zip.ZipException: error in opening zip file

2012-10-30 Thread Mark Neyer
i haven't set nativepath

it looks like aptitude installed lein 1.7

i downloaded lein2, and it works. thanks so much man! <3

On Tuesday, October 30, 2012 2:38:53 PM UTC-7, AtKaaZ wrote:
>
> How come you got this message?
> *Copying 91 files to /home/mark/gc/src/titan-test-**case/lib*
>
> Did you use a different project.clj which has 
>
> :native-path
>
> ?
> Because it seems it's happening when trying to extract the native deps 
> from a jar into the lib folder in your project.
> I tried adding :native-path "lib"
> but nothing happens (no lib folder gets created)
> Oh wait, are you using lein1 ?
>
> On Tue, Oct 30, 2012 at 9:23 PM, Mark Neyer 
> > wrote:
>
>> i'm trying to get a graph database running on my machine, and when i run 
>> lein deps (after rm -rf  ~/.m2  and $PROJECT_DIR/lib ) i keep seeing this:
>>
>>
>> [INFO] Unable to find resource 'com.sun.xml.bind:jaxb-impl:jar:2.1.12' in 
>> repository ghelmling.testing (http://people.apache.org/~garyh/mvn/)
>> Downloading: com.sun.xml.bind/jars/jaxb-impl-2.1.12.jar from repository 
>> m1.dev.java.net at http://download.java.net/maven/1
>> Transferring 847K from m1.dev.java.net
>> Copying 91 files to /home/mark/gc/src/titan-test-case/lib
>> Exception in thread "main" java.lang.RuntimeException: 
>> java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
>> at clojure.lang.Compiler.eval(Compiler.java:5441)
>> at clojure.lang.Compiler.eval(Compiler.java:5392)
>> at clojure.core$eval.invoke(core.clj:2382)
>> at clojure.main$eval_opt.invoke(main.clj:235)
>> at clojure.main$initialize.invoke(main.clj:254)
>> at clojure.main$script_opt.invoke(main.clj:270)
>> at clojure.main$main.doInvoke(main.clj:354)
>> at clojure.lang.RestFn.invoke(RestFn.java:457)
>> at clojure.lang.Var.invoke(Var.java:377)
>> at clojure.lang.AFn.applyToHelper(AFn.java:172)
>> at clojure.lang.Var.applyTo(Var.java:482)
>> at clojure.main.main(main.java:37)
>> Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error 
>> in opening zip file
>> at clojure.lang.LazySeq.sval(LazySeq.java:47)
>> at clojure.lang.LazySeq.seq(LazySeq.java:56)
>> at clojure.lang.Cons.next(Cons.java:39)
>> at clojure.lang.RT.next(RT.java:560)
>> at clojure.core$next.invoke(core.clj:61)
>> at leiningen.deps$extract_native_deps.invoke(deps.clj:174)
>> at leiningen.deps$deps.doInvoke(deps.clj:200)
>> at clojure.lang.RestFn.invoke(RestFn.java:410)
>> at leiningen.compile$prep.invoke(compile.clj:150)
>> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
>> at clojure.lang.RestFn.invoke(RestFn.java:425)
>> at leiningen.compile$compile.invoke(compile.clj:283)
>> at leiningen.compile$prep$fn__2010.invoke(compile.clj:148)
>> at leiningen.compile$prep.invoke(compile.clj:147)
>> at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
>> at clojure.lang.RestFn.invoke(RestFn.java:490)
>> at leiningen.run$run_main.doInvoke(run.clj:26)
>> at clojure.lang.RestFn.invoke(RestFn.java:425)
>> at clojure.lang.AFn.applyToHelper(AFn.java:163)
>> at clojure.lang.RestFn.applyTo(RestFn.java:132)
>> at clojure.core$apply.invoke(core.clj:544)
>> at leiningen.run$run.doInvoke(run.clj:57)
>> at clojure.lang.RestFn.invoke(RestFn.java:410)
>> at clojure.lang.Var.invoke(Var.java:365)
>> at clojure.lang.AFn.applyToHelper(AFn.java:161)
>> at clojure.lang.Var.applyTo(Var.java:482)
>> at clojure.core$apply.invoke(core.clj:542)
>> at leiningen.core$apply_task.invoke(core.clj:262)
>> at leiningen.core$_main.doInvoke(core.clj:329)
>> at clojure.lang.RestFn.invoke(RestFn.java:410)
>> at clojure.lang.AFn.applyToHelper(AFn.java:161)
>> at clojure.lang.RestFn.applyTo(RestFn.java:132)
>> at clojure.core$apply.invoke(core.clj:542)
>> at leiningen.core$_main.invoke(core.clj:332)
>> at user$eval42.invoke(NO_SOURCE_FILE:1)
>> at clojure.lang.Compiler.eval(Compiler.java:5425)
>> ... 11 more
>> Caused by: java.util.zip.ZipException: error in opening zip file
>> at java.util.zip.ZipFile.open(Native Method)
>> at java.util.zip.ZipFile.(ZipFile.java:214)
>> at java.util.zip.ZipFile.(ZipFile.java:144)
>> at java.util.jar.JarFile.(JarFile.java:152)
>> at java.util.jar.JarFile.(JarFile.java:116)
>> at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown 
>> Source)
>> at 
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
>> at clojure.lang.Reflector.invokeConstructor(Reflector.java:160)
>> at 
>> leiningen.deps$extract_native_

Re: About code help: is it ok to ask for how to improve?

2012-10-30 Thread Paul deGrandis
In addition to suggestion by Nicolas, you should also feel free to pop on 
IRC and join #clojure.

Posting a question and gist in IRC is a great way to get quick feedback, 
advice, and general help.

Paul

On Tuesday, October 30, 2012 2:50:27 PM UTC-7, Sean S wrote:
>
> Extremely new to clojure, so most of what I write feels really cumbersome. 
> Was curious is I'm allowed to post code to get opinions on.
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure CA over email thread on clojure-dev

2012-10-30 Thread Andy Fingerhut
The concept of selection bias is only applicable when you are trying to get a 
representative sample of a population.

I don't think the idea of the discussion is to go by majority vote.  It is to 
find a process that meets the criteria decided upon by the Clojure/core 
members.  I'm not one of them, but that seems reasonable to me.

For example, if the process ends up becoming:

Print out a copy of the paper CA, sign it, then fax or scan & email the 
signed paper document.

Then that seems like it should enable more people to submit a signed CA more 
cheaply from more places in the world than before, and might meet the legal 
criteria that the Clojure/core team wants to preserve (whatever that might be). 
 I'm not saying that is what the process will become, but it is one among many 
possibilities.

Andy

On Oct 30, 2012, at 2:51 PM, Michael Klishin wrote:

> It was brought to my attention that there is a "Clojure CA over email" thread 
> going on clojure-dev:
> 
> https://groups.google.com/group/clojure-dev/browse_thread/thread/e81484f0eaa76277
> 
> Because folks who have a problem with the current paper CA process are least 
> likely to be on that list
> (that requires you to mail a paper CA in before you can join), I am posting 
> this here.
> 
> Clojure/core et al: please consider starting important conversations around 
> how Clojure contribution works on this mailing list,
> not on clojure-dev. Because, selection bias.
> -- 
> MK
> 
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure CA over email thread on clojure-dev

2012-10-30 Thread Michael Klishin
2012/10/31 Andy Fingerhut 

> I don't think the idea of the discussion is to go by majority vote


It's not about making decisions by majority vote, Andy. It is about
making sure many members of the community can *participate* or even
simple be aware of important discussions.

Most people don't follow clojure-dev because you can't subscribe to it the
usual way.

Discussing the issue of the contribution process being an unnecessary pain
in a small group of people who have already gone through the process does
not
make any sense to me.
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure CA over email thread on clojure-dev

2012-10-30 Thread Andy Fingerhut
On Oct 30, 2012, at 3:58 PM, Michael Klishin wrote:

> 2012/10/31 Andy Fingerhut 
> I don't think the idea of the discussion is to go by majority vote
> 
> It's not about making decisions by majority vote, Andy. It is about
> making sure many members of the community can *participate* or even
> simple be aware of important discussions.
> 
> Most people don't follow clojure-dev because you can't subscribe to it the 
> usual way.
> 
> Discussing the issue of the contribution process being an unnecessary pain 
> in a small group of people who have already gone through the process does not
> make any sense to me.

The discussion may have arisen because the contribution process is a pain for 
many, but that is not what it is _about_.

It is hopefully more productive than that.  It is to try to find a process that 
is less of a pain and is acceptable to Clojure/core.

I should have said in my previous message, but feel free to suggest all the 
ideas you want for alternate processes.  If one of them is considered better 
than all of the suggestions made so far, and/or you are willing to hire a 
lawyer to help legally vet a new process, I think your voice would be sampled 
with an extremely heavy bias :-)

Andy

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN: Late October London Clojure Dojo at Thoughtworks on 30 October 2012

2012-10-30 Thread Andrew Cowper
Code from Team 2

https://gist.github.com/3983804

Thanks for another fun dojo...

Andrew

On Monday, 22 October 2012 12:20:35 UTC+1, Bruce Durling wrote:
>
> Roll up! Roll up! 
>
> On Tuesday 30 October we'll be having another clojure dojo, this time 
> hosted by ThoughtWorks. Details and sign up here: 
>
> http://late-october-2012-ldnclj-dojo.eventbrite.co.uk/ 
>
> I hope to see you all there! 
>
> The dojo is a fun and welcoming place for beginners and experienced 
> clojurians to learn more about clojure through practical exercises. 
>
> We run dojos and talks every month and try to make the dates regular 
> to help people come and visit us. We hope you can make it to this or 
> future events. We currently have a talk on the 1st Tuesday of the 
> month, every month except January and 2 dojos per month, on mid-month 
> and one on the last Tuesday of the month. All talks and dojos are 
> announced on the london-clojurians google group and the clojure google 
> group link above. 
>
> -- 
> @otfrom | CTO & co-founder @MastodonC | mastodonc.com 
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [core.logic] Detecting overlapping FDs

2012-10-30 Thread David Nolen
On Tue, Oct 30, 2012 at 1:11 PM, Anthony Rosequist <
anthony.rosequ...@gmail.com> wrote:

> I'm playing around with core.logic, and have this code so far:
>
> https://gist.github.com/3981557
>

It might help to understand exactly what kind of output were you expecting.

David

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

MVC / Observer & Immutable Data

2012-10-30 Thread Alexey Petrushin
MVC / Observer in Immutable Data

Can You please explain what are analogues of MVC / Observer techniques in 
two cases:

1. Immutable Objects (OOP style)
2. Immutable Data (functional style)

For example let's consider following simple GUI example (You can try it 
live here http://tinkerbin.com/0XDHRXIl click 'Run' button to start it and 
wait 2 sec for text to appear)

It's built with JavaScript because it's easy to play and MVC / Observer are 
very natural to it

// Model containing the data.
var Post = Backbone.Model.extend({}) 

var PostView = Backbone.View.extend({
  initialize: function() {
// Registering view rendering method as
// an observer on the model.
this.model.on('all', this.render.bind(this))
  },  
  // Every time state of model changes 
  // this method will be called.
  render: function() {
// Printing value of model.text attriubute. 
this.$el.html(this.model.get('text'))
return this
  }
})

// Now, any time the model is updated the view will be also 
// automatically updated.
post.set({text: "hello, it's me"})

But I don't quite understand how to do the same with Immutable OOP and 
Functional styles, what ways are there?

Thanks, Alex.

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread arekanderu
I also happened to read an interesting 
articlerecently
 about functional programming by John 
Carmack . 

On Tuesday, October 30, 2012 9:00:07 AM UTC+2, titon barua wrote:
>
> Hi,
> I am very new to Clojure and functional programming in general. I am game 
> development enthusiast(although did nothing more than a tetris clone in 
> python and C). As far as i've seen OpenGL, it's mostly state manipulation 
> and seems to me like completely against Clojure's philosophy. Could there 
> exist some kind of magic that makes all the state manipulations disappear?
>
> By the way, I think Clojure's concurrency capabilities can upsurge a new 
> era for game development as "GigaHertz war" have pretty much stopped and 
> game developers are  still reluctant to use full capabilities of multi-core 
> hardware. Perhaps they didn't discover clojure yet? (:
>
> I for one would like some good and maintained wrappers for input and 
> graphics in Clojure - like SDL and OpenGL.
>
> Disclaimer: I am a wannabe game dev chained to internet/web paradigm for 
> financial reasons ... :(
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Question about doseq

2012-10-30 Thread arekanderu
Hello all,

I have the following code:

(def my-hash {"1" {:a-key {:value "a value"} :another-key "another value" 
>> :a-third-key []}
>
>  "2" {:a-key {:value "a value"} :another-key "another 
>> value" :a-third-key []}}
>
>
In the following example i get the following result: 

user=> (doseq [[id item] my-hash] (println item))

{:a-key {:value a value}, :another-key another value, :a-third-key []}

{:a-key {:value a value}, :another-key another value, :a-third-key []}

nil


On the above example, it looks *almost* normal to me. For instance, why 
*{:value 
a value}* is not returned as *{:value "a value"} *? Same goes for *:another 
key*
It still looks like a hashmap though. Isn't it?

The behavior however which confused me even more is the following:

user=> (doseq [[id item] my-hash
>   key (:a-key item)]
> (println key)) 
> [:value a value]
> [:value a value]
> nil


I was expecting the above to return:

{:value "a value"} 
> {:value "a value"}
> nil


Can someone explain to me why vector is being returned and how can I 
achieve the result I was expecting? What am I missing here? Am i misusing 
the doseq bindings? 

Thank you for your time

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Satoru Logic
Hi, all.

I am reading Clojure in Action.

In the "scope" section of Chapter3, there are examples like this:

  defn twice [x]
  (println "original function")
  (* 2 x))

(defn call-twice [y]
  (twice y))

(defn with-log [function-to-call log-statement]
  (fn [& args]  

(println log-statement)
(apply function-to-call args)))

(call-twice 10)

(binding [twice (with-log twice "Calling the twice function")]
   (call-twice 20))

(call-twice 30)


When I tried to run this code in repl, I got the following exception:


IllegalStateException Can't dynamically bind non-dynamic var: user/twice 
> clojure.lang.Var.pushThreadBindings (Var.java:353)


Is the book wrong or I'm running with the wrong version of clojure? 
  
 

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [core.logic] Detecting overlapping FDs

2012-10-30 Thread Anthony Rosequist
On Tuesday, October 30, 2012 6:48:28 PM UTC-5, David Nolen wrote:

> On Tue, Oct 30, 2012 at 1:11 PM, Anthony Rosequist 
> 
> > wrote:
>
>> I'm playing around with core.logic, and have this code so far:
>>
>> https://gist.github.com/3981557
>>
>
> It might help to understand exactly what kind of output were you expecting.
>
> David
>

Thanks for the quick reply, David. The little bit that I've seen of 
core.logic has been mind-blowing so far.

My code is outputting ([[1 A 0 5] [2 A 0 9] [3 A 0 3]]) now, which is 
"wrong" because person A is doing all three tasks between times 0 and 3 
(and two of the tasks between times 4 and 5).

I would expect something like ([[1 A 0 5] [2 *B* 0 9] [3 A *6 9*]]), where 
person A is performing tasks 1 and 3 (but not simultaneously) and person B 
is performing task 2. Given any two output vectors, [task1 person1 start1 
end1] and [task2 person2 start2 end2], I think I want this to be true:

(conde
  [(!= person1 person2)]
  [(<=fd start2 start1) (<=fd end2 start1)]
  [(<=fd end1 start2) (<=fd end1 end2)])

I don't know how to state that this should be true for all combinations of 
the 3 output vectors. Eventually, I will have a variable number of people 
and tasks, so I don't want to just hard-code this conde statement 3 times. 
I've tried using recursion in a defne and I've also tried using doseq, but 
I couldn't get either to work.

This might not even be a good use case for core.logic. I'm just toying with 
some different ideas.

Of course, I can easily change any of the input or output forms if it would 
make this easier.

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread gaz jones
As of Clojure 1.3 you need to mark things you with to re-bind
explicitly as dynamic:

(defn ^:dynamic twice [x]
  ...)


On Tue, Oct 30, 2012 at 7:42 PM, Satoru Logic  wrote:
> Hi, all.
>
> I am reading Clojure in Action.
>
> In the "scope" section of Chapter3, there are examples like this:
>
> defn twice [x]
>   (println "original function")
>   (* 2 x))
>
> (defn call-twice [y]
>   (twice y))
>
> (defn with-log [function-to-call log-statement]
>   (fn [& args]
>
> (println log-statement)
> (apply function-to-call args)))
>
>   
>
> (call-twice 10)
>
>   
>
> (binding [twice (with-log twice "Calling the twice function")]
>(call-twice 20))
>
>   
>
> (call-twice 30)
>
>
> When I tried to run this code in repl, I got the following exception:
>
>
>> IllegalStateException Can't dynamically bind non-dynamic var: user/twice
>> clojure.lang.Var.pushThreadBindings (Var.java:353)
>
>
> Is the book wrong or I'm running with the wrong version of clojure?
>
>   
>   
>   
>   
>
> --
> 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 your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Andy Fingerhut
The code works as written in Clojure 1.2 and 1.2.1.

It doesn't in 1.3 and later, unless you change the definition of twice to 
annotate that it is a dynamic var, like so:

(defn ^:dynamic twice [x]
  (println "original function")
  (* 2 x))

With that change, it works in Clojure 1.3 and later.

Andy


On Oct 30, 2012, at 5:42 PM, Satoru Logic wrote:

> Hi, all.
> 
> I am reading Clojure in Action.
> 
> In the "scope" section of Chapter3, there are examples like this:
> 
> defn twice [x]
>   (println "original function")
>   (* 2 x))
> (defn call-twice [y]
>   (twice y))
> (defn with-log [function-to-call log-statement]
>   (fn [& args]
> (println log-statement)
> (apply function-to-call args)))
>   
> (call-twice 10)
>   
> (binding [twice (with-log twice "Calling the twice function")]
>(call-twice 20))
>   
> (call-twice 30)
> 
> When I tried to run this code in repl, I got the following exception:
> 
> IllegalStateException Can't dynamically bind non-dynamic var: user/twice  
> clojure.lang.Var.pushThreadBindings (Var.java:353)
> 
> Is the book wrong or I'm running with the wrong version of clojure? 

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Question about doseq

2012-10-30 Thread dennis zhuang
Please use prn insteadof println. By default, pr and prn print in a way
that objects can be read by the reader,but print and println produce output
for human consumption.

2012/10/31 arekanderu 

> Hello all,
>
> I have the following code:
>
> (def my-hash {"1" {:a-key {:value "a value"} :another-key "another value"
>>> :a-third-key []}
>>
>>  "2" {:a-key {:value "a value"} :another-key "another
>>> value" :a-third-key []}}
>>
>>
> In the following example i get the following result:
>
> user=> (doseq [[id item] my-hash] (println item))
>
> {:a-key {:value a value}, :another-key another value, :a-third-key []}
>
> {:a-key {:value a value}, :another-key another value, :a-third-key []}
>
> nil
>
>
> On the above example, it looks *almost* normal to me. For instance, why 
> *{:value
> a value}* is not returned as *{:value "a value"} *? Same goes for *:another
> key*
> It still looks like a hashmap though. Isn't it?
>
> The behavior however which confused me even more is the following:
>
> user=> (doseq [[id item] my-hash
>>   key (:a-key item)]
>> (println key))
>> [:value a value]
>> [:value a value]
>> nil
>
>
> I was expecting the above to return:
>
> {:value "a value"}
>> {:value "a value"}
>> nil
>
>
> Can someone explain to me why vector is being returned and how can I
> achieve the result I was expecting? What am I missing here? Am i misusing
> the doseq bindings?
>
> Thank you for your time
>
> --
> 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
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [core.logic] Detecting overlapping FDs

2012-10-30 Thread David Nolen
On Tue, Oct 30, 2012 at 8:58 PM, Anthony Rosequist <
anthony.rosequ...@gmail.com> wrote:

> (conde
>   [(!= person1 person2)]
>   [(<=fd start2 start1) (<=fd end2 start1)]
>   [(<=fd end1 start2) (<=fd end1 end2)])
>

Here's a version that at least guarantees that people aren't appearing in
the task list right after themselves.

(defrel person id)
(defrel task id start end duration)

(facts person [['A] ['B]])
(facts task [[1 0 10 5]
 [2 0 10 9]
 [3 0 11 3]])

(defne personso [q]
  ([()])
  ([[[_ p _ _] . r]]
(person p)
(personso r)))

(defne time-intervalso [q lp]
  ([() _])
  ([[[_ a _ _]] [_ b _ _]] (!= a b))
  ([[[ta a as ae] bv . r]]
 (matche [bv]
   ([[tb b bs be]]
  (!= a b)
  (time-intervalso r bv)

(let [data [[1 (lvar) (lvar) (lvar)]
[2 (lvar) (lvar) (lvar)]
[3 (lvar) (lvar) (lvar)]]]
(run* [q]
  (== q data)
  (personso q)
  (time-intervalso q (lvar
;; ([[1 A _.0 _.1] [2 B _.2 _.3] [3 A _.4 _.5]] [[1 B _.0 _.1] [2 A _.2
_.3] [3 B _.4 _.5]])


Even so I don't really understand the time conditions you've described at
all. Can you please clarify or draw a simple picture with text what results
you are expecting? I'm a bit confused by your task facts in particular, for
example start 0, end 10 but duration 5 ???

Thanks,
David

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [core.logic] Detecting overlapping FDs

2012-10-30 Thread Anthony Rosequist
On Tuesday, October 30, 2012 9:26:25 PM UTC-5, David Nolen wrote:
>
> Even so I don't really understand the time conditions you've described at 
> all. Can you please clarify or draw a simple picture with text what results 
> you are expecting? I'm a bit confused by your task facts in particular, for 
> example start 0, end 10 but duration 5 ???
>
> Thanks,
> David
>

Thanks for the sample code; I'll stew over it for a while to make sure I 
understand it.

Sorry, I didn't do a very good job of explaining the problem I'm trying to 
solve. Here's a quick picture that might help:

https://docs.google.com/drawings/pub?id=1gmjjjo6YIiBGCvm87BEgvsqONZpavmBeV0TtpDDDI8A&w=904&h=496

The blue arcs on top represent the start/end times from the task facts. 
Tasks 1 and 2 must be completed between times 0 and 10, and task 3 must be 
completed between times 0 and 11. Since task 1 only takes 5 units of time 
to complete, though, you have some space: you can complete it from 0-5 or 
1-6 or 2-7 or 3-8 or 4-9 or 5-10. But, you can't start task 1 before time 0 
and you can't finish it after time 10 (and it must take 5 minutes to 
complete). That's what the facts denote.

The start/end times in the output represent the times that the task is 
actually being performed.

The red section represents the current output. Person A is assigned all 
three tasks, and person B is assigned none. The problem is that the three 
tasks are completed from 0-5, 0-9, and 0-3. This means that person A is 
doing all three tasks simultaneously (during times 0-3), which isn't 
allowed. During times 4-5, he's still doing tasks 1 and 2, which is also 
not allowed.

Instead, the green section is what I'm hoping to get. Each task falls 
within the range given by the blue arcs on top and neither person has to do 
more than one task at a time.

I'm not sure this helps explain the problem any more than before. Again, 
this certainly isn't an important problem for me to solve, so I'd hate to 
waste too much of your time on it.

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Sean Corfield
Yes, it's very unfortunate that Manning released Clojure in Action
without a final pass to make it Clojure 1.3 compatible. I talked to
them about it when they still had time to make changes but they
decided to go ahead and publish a book that is tightly wedded to
Clojure 1.2 after Clojure 1.3 had been released. I think it was a
disservice to both the author and the community :(

Sean

On Tue, Oct 30, 2012 at 6:36 PM, Andy Fingerhut
 wrote:
> The code works as written in Clojure 1.2 and 1.2.1.
>
> It doesn't in 1.3 and later, unless you change the definition of twice to
> annotate that it is a dynamic var, like so:
>
> (defn ^:dynamic twice [x]
>   (println "original function")
>   (* 2 x))
>
> With that change, it works in Clojure 1.3 and later.
>
> Andy

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Satoru Logic
Could you please recommend a book that's more up-to-date?

On Wednesday, October 31, 2012 11:26:48 AM UTC+8, Sean Corfield wrote:
>
> Yes, it's very unfortunate that Manning released Clojure in Action 
> without a final pass to make it Clojure 1.3 compatible. I talked to 
> them about it when they still had time to make changes but they 
> decided to go ahead and publish a book that is tightly wedded to 
> Clojure 1.2 after Clojure 1.3 had been released. I think it was a 
> disservice to both the author and the community :( 
>
> Sean 
>
> On Tue, Oct 30, 2012 at 6:36 PM, Andy Fingerhut 
> > wrote: 
> > The code works as written in Clojure 1.2 and 1.2.1. 
> > 
> > It doesn't in 1.3 and later, unless you change the definition of twice 
> to 
> > annotate that it is a dynamic var, like so: 
> > 
> > (defn ^:dynamic twice [x] 
> >   (println "original function") 
> >   (* 2 x)) 
> > 
> > With that change, it works in Clojure 1.3 and later. 
> > 
> > Andy 
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Satoru Logic
Does this mean vars are dynamic by default prior to Clojure1.3, and lexical 
afterwards?

On Wednesday, October 31, 2012 9:36:47 AM UTC+8, Andy Fingerhut wrote:
>
> The code works as written in Clojure 1.2 and 1.2.1.
>
> It doesn't in 1.3 and later, unless you change the definition of twice to 
> annotate that it is a dynamic var, like so:
>
> (defn ^:dynamic twice [x]
>   (println "original function")
>   (* 2 x))
>
> With that change, it works in Clojure 1.3 and later.
>
> Andy
>
>
> On Oct 30, 2012, at 5:42 PM, Satoru Logic wrote:
>
> Hi, all.
>
> I am reading Clojure in Action.
>
> In the "scope" section of Chapter3, there are examples like this:
>
>   defn twice [x]
>   (println "original function")
>   (* 2 x))
>
> (defn call-twice [y]
>   (twice y))
>
> (defn with-log [function-to-call log-statement]
>   (fn [& args]
>
> (println log-statement)
> (apply function-to-call args)))
>
> (call-twice 10)
>
> (binding [twice (with-log twice "Calling the twice function")]
>(call-twice 20))
>
> (call-twice 30)
>
>
> When I tried to run this code in repl, I got the following exception:
>
>
> IllegalStateException Can't dynamically bind non-dynamic var: user/twice 
>> clojure.lang.Var.pushThreadBindings (Var.java:353)
>
>
> Is the book wrong or I'm running with the wrong version of clojure? 
>
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [core.logic] Detecting overlapping FDs

2012-10-30 Thread Anthony Rosequist
I updated my gist with a solution that's working:

https://gist.github.com/3981557

Unfortunately, I had to copy my conde expression 3 times (to cover all 
combinations of the three tasks). So, what I really need to know is if 
there's a way for me to write those three condes as one goal that takes q 
as an input and supports an arbitrary number of tasks? Or would this 
strategy not be performant enough with more than 3 or 4 tasks?

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Sean Corfield
On Tue, Oct 30, 2012 at 8:38 PM, Satoru Logic  wrote:
> Could you please recommend a book that's more up-to-date?

Clojure Programming http://www.clojurebook.com/ would be my first choice.

Programming Clojure 2nd Edition
http://pragprog.com/book/shcloj2/programming-clojure would be my
second choice.

The Joy of Clojure http://manning.com/fogus/ is an older book but is
more high-level - the "why" of functional programming - so it's still
applicable to more recent Clojure versions, but definitely a book for
when you have more Clojure under your belt.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Satoru Logic
Thanks

On Wednesday, October 31, 2012 12:41:24 PM UTC+8, Sean Corfield wrote:
>
> On Tue, Oct 30, 2012 at 8:38 PM, Satoru Logic 
> > 
> wrote: 
> > Could you please recommend a book that's more up-to-date? 
>
> Clojure Programming http://www.clojurebook.com/ would be my first choice. 
>
> Programming Clojure 2nd Edition 
> http://pragprog.com/book/shcloj2/programming-clojure would be my 
> second choice. 
>
> The Joy of Clojure http://manning.com/fogus/ is an older book but is 
> more high-level - the "why" of functional programming - so it's still 
> applicable to more recent Clojure versions, but definitely a book for 
> when you have more Clojure under your belt. 
> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Question about doseq

2012-10-30 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Mittwoch, 31. Oktober 2012 01:29:11 UTC+1 schrieb Ryan T.:
>
> user=> (doseq [[id item] my-hash
>>   key (:a-key item)]
>> (println key)) 
>> [:value a value]
>> [:value a value]
>> nil
>
>
>
The next step in the doseq also introduces a seq traversal. So your map is 
turned into a sequence of map entries. You can see this by providing map 
with more than one entry. To get your result try the following (combined 
with prn mentioned already):

(doseq [[id item] my-hash
:let [key (:a-key item)]]
  (prn key))

Kind regards
Meikel

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en