Re: docs for ^:once

2013-09-13 Thread Jozef Wagner
There is also a recent discussion on IRC about that,
http://clojure-log.n01se.net/date/2013-08-29.html#10:47 and official
documentation mentions it at the end of http://clojure.org/lazy

JW



On Thu, Sep 12, 2013 at 8:56 PM, Brian Craft craft.br...@gmail.com wrote:

 I still don't really understand ^:once. Are there docs anywhere? Is there
 a way to inspect a function for this property?

  --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] CloCoP - constraint programming for Clojure

2013-09-13 Thread Dmitry Groshev
Great stuff!

I'm wondering what's the realworld difference between JaCoP and CHOCO. 
Why did you choose the former?

On Tuesday, September 10, 2013 5:39:46 AM UTC+4, Alex Engelberg wrote:

 http://github.com/aengelberg/clocop

 CloCoP is a Clojure wrapper of the Java library JaCoP. The acronyms stand 
 for Clojure/Java Constraint Programming. This invites comparison to the 
 core.logic library, and you may wonder why we need both. There are a few 
 ways in which, in my opinion, the JaCoP system is better than core.logic:

- JaCoP is more plug-in-able, with an extensive set of 
customizations to the way that the search operates. There are interfaces 
for different components of the search, and each has several 
implementations. 
- I found that with core.logic, I was somewhat limited by the set of 
available constraints. JaCoP has many different constraints that seem to 
more suit my needs for solving challenging problems. 
- As the core.logic people 
 say,https://github.com/clojure/core.logic/wiki/External-solversJaCoP is 
 anywhere from 10X-100X faster than core.logic at solving Finite 
Domain problems.

 JaCoP has a lot of global constraints which are very powerful and 
 essential for describing certain problems. As Radoslaw Szymanek (an 
 author of JaCoP) says, CP without global constraints is just [a] plain 
 academic toy. Using problems with arithmetic constraints is doing CP bad 
 publicity.

 If you'd like to see implementations of sample problems in CloCoP, check 
 out the test 
 caseshttps://github.com/aengelberg/clocop/tree/master/test/clocop
  (https://github.com/aengelberg/clocop/tree/master/test/clocop).


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Clojure, floats, ints and OpenGL

2013-09-13 Thread Mikera
On Friday, 13 September 2013 12:11:50 UTC+8, tbc++ wrote:

  If we can do away with the interface generation, then support for 
 arbitrary primitive arguments should become relatively straightforward.

 How would we even call a function without an interface? Remember 
 everything is defined behind vars, so you simply can't assume that a 
 function won't be re-defed without notice. This is the reason interfaces 
 exist notice how the following works:

 user= (defn foo ^long [^long x] x)
 #'user/foo
 user= (defn baz [x] (foo x))
 #'user/baz
 user= (baz 42)
 42
 user= (defn foo ^double [^double x] x)
 #'user/foo
 user= (baz 42)

 ClassCastException user$foo cannot be cast to clojure.lang.IFn$LL 
  user/baz (NO_SOURCE_FILE:1)
 user=


Good example to discuss!

I agree there is a subtle tradeoff between performance and dynamism here.

Any interface dispatch via a var uses an extra level of indirection (in the 
dynamic var case, this includes a thread-local check for any bindings) and 
already adds some overhead. If you are happy using Clojure's dynamic 
features to pass arbitrary (boxed / Object) arguments and redefine vars on 
the fly like that, you probably don't really care about optimal performance 
very much anyway and a standard IFn invoke should be OK. 

For performance-sensitive code, you ideally want primitive-typed code to be 
compiled to a direct method call (invokevirtual) and not go via any var 
lookup / interface invoke at all. This would mean you would also need to 
redefine/recompile baz if you wanted to use a changed version of foo, but 
that's a relatively minor inconvenience IMHO. If you redefine baz after 
redefining foo (e.g. by reloading the whole namespace), then everything 
will still work. I'm not sure if it is possible to get this precise 
behaviour in Clojure at present - but it would certainly be great for high 
performance code.

If we want *both* maximum performance and dynamic flexibility, then I think 
we need a completely different approach. Clojure vars as currently designed 
won't cut it. Probably something like an on-demand re-compilation strategy 
based on a var dependency graph would be needed. I personally think that's 
the right long-term direction, but that's definitely Clojure 2.0 territory.
 


 Do a prototype with definterface/genclass or something and then report 
 your results. My suspicions are that you'll find doing this without 
 interfaces, while maintaining Clojure's semantics, is impossible.


You may be right. Though it also probably depends on what you consider 
documented (promised not to change in public API) vs. undocumented 
(implementation detail) semantics. Some of the subtleties on what happens 
to existing code when you redefine vars are arguably in the latter 
category. Observe:

(defn foo ^double [^double x] (inc x))
(defn baz [x] (foo x))
(baz 42)
= 43.0
(ns-unmap *ns* 'foo)
(defn foo ^double [^double x] (dec x))
(baz 42)
= 43.0

i.e. it's fairly easy to trick Clojure into keeping an old version of a var 
around. Does that count as officially documented behaviour we are obliged 
to maintain?

Either way, if Clojure's semantics prove to be a fundamental issue for 
performance, then I think it is better to start work to improve Clojure's 
semantics (perhaps targeting 2.0 if we think it's a really big breaking 
change). This would be better, IMHO, than forever accepting semantics that 
prevent idiomatic code from ever being truly fast. I'd rather see a bit of 
breakage and fix my code when upgrading to Clojure 2.0 than be stuck with 
poor performance forever.

 


 Timothy


 On Thu, Sep 12, 2013 at 8:41 PM, Mikera mike.r.an...@gmail.comjavascript:
  wrote:

 People *have* run into this problem a lot. People have just worked around 
 it. The existence of great libraries like HipHip and vectorz-clj and some 
 of Zach's stuff is IMHO to a large extent because people have needed high 
 performance operations (often involving primitives / primitive arrays / 
 custom JVM types) and have found it easier to implement these in a new 
 library than wait for the support to appear in Clojure itself.

 So we have lots of great, performance-oriented libraries. Cool. 

 But not having comprehensive JVM primitive support is still a big problem 
 for Clojure. It means that:
 a) We'll get lots of ecosystem fragmentation as people with slightly 
 different requirements implement their own solutions in slightly 
 different/incompatible ways. We're seeing this already. Lisp Curse etc.
 b) People with very strong performance requirements on the JVM (e.g. 
 OpenGL, big data numerics, scientific computing, heavy duty websites) are 
 more likely to avoid Clojure and do their work in Scala / Java instead. The 
 community will lose exactly the people who have both the motivation and 
 skills to fix these kind of issues.
 c) We won't get the wider reputation for performance that I think Clojure 
 deserves and should aspire to. And this is important - rightly or wrongly, 
 

clojure.java.jdbc connection pool example

2013-09-13 Thread Josh Kamau
Hello there ;

I am in desparate need of a clojure.jdbc with a connection pool example.

I have googled and the link to github example is broken.

Please help.

Thanks.
Josh

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.java.jdbc connection pool example

2013-09-13 Thread Shantanu Kumar
Hi Josh,

On Friday, 13 September 2013 15:52:47 UTC+5:30, Josh Kamau wrote:

 Hello there ;

 I am in desparate need of a clojure.jdbc with a connection pool example. 


You can see an example here that uses Apache DBCP (please excuse the plug):
https://github.com/kumarshantanu/clj-dbcp

There are C3P0 and BoneCP connection pool libraries too:
https://github.com/opiskelijarekisteri-devel/clj-bonecp
http://stackoverflow.com/questions/11571433/what-is-the-proper-way-to-store-a-global-connection-in-clojure

Shantanu



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.java.jdbc connection pool example

2013-09-13 Thread Josh Kamau
Thanks alot.

Let me check them out.

Josh


On Fri, Sep 13, 2013 at 1:41 PM, Shantanu Kumar kumar.shant...@gmail.comwrote:

 Hi Josh,


 On Friday, 13 September 2013 15:52:47 UTC+5:30, Josh Kamau wrote:

 Hello there ;

 I am in desparate need of a clojure.jdbc with a connection pool example.


 You can see an example here that uses Apache DBCP (please excuse the plug):
 https://github.com/kumarshantanu/clj-dbcp

 There are C3P0 and BoneCP connection pool libraries too:
 https://github.com/opiskelijarekisteri-devel/clj-bonecp

 http://stackoverflow.com/questions/11571433/what-is-the-proper-way-to-store-a-global-connection-in-clojure

 Shantanu

  --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Different behaviour when using (def ^:macro ...) outside top-level

2013-09-13 Thread André Gustavo Rigon
Yeah, it's the difference in behaviour that I don't understand.

Thanks for the workaround though Gunnar.

On Friday, September 13, 2013 2:35:37 AM UTC-3, Cedric Greevey wrote:

 On Fri, Sep 13, 2013 at 1:08 AM, Gunnar Völkel 
 gunnar@googlemail.comjavascript:
  wrote:

 `def` does not handle `:macro true` metadata on the provided symbol.

  
 Umm ... according to the OP, it worked perfectly when the def was a 
 top-level form, just not when it was nested in an if. If your claim were 
 correct the OP would have had no joy with either my-defn1 *or* my-defn2, 
 rather than only the latter not working.



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


reference types (var, atom, ref, agent) and add-watch: deterministic order of notification

2013-09-13 Thread gixxi
Hi,

i got a question on reference type instances with attached watches.

Consider a reference type instance R with a watch W attached by (add-watch 
R :watcher #(...)) and

a n parallel activities committing a transition to R in some monotonic 
order 0..n-1.

Does Clojure ensure that the function calls by the watch dog are executed 
in the very same order? Is it possible to wrap the watch dog notification 
in a synchronisation block?

Thanks in advance

Best regards

Christian

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.java.jdbc connection pool example

2013-09-13 Thread gixxi
Hi Josh,

I would opt for using Tomcat 7 Pool API - 
http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

The following code wraps the pool api and provides reading a config file

(ns foo
  (:require [clojure.java.io :as io])
  (:import [java.io PushbackReader])
  (:gen-class))

(defn conf [file]
  Reads a config file containing the connection params (url, driver)
  (binding [*read-eval* false]
(with-open [r (io/reader file)]
  (read (PushbackReader. r)

(defn datasource [file]
  creates a pooled data source
  (let
[config (conf file) ds (new org.apache.tomcat.jdbc.pool.DataSource) pp 
(new org.apache.tomcat.jdbc.pool.PoolProperties)]
(do
  (.setDriverClassName pp (:classname config))
  (.setUrl pp (:subname config))
  (.setUsername pp (:user config))
  (.setPassword pp (:password config))
  (.setTestOnBorrow pp true)
  (.setValidationQuery pp SELECT 1)
  (.setMaxActive pp 5)
  (.setInitialSize pp 1)
  (.setMaxWait pp 1)
  (.setPoolProperties ds pp)
  (identity ds

create a file dbconnection.ini with you jdbc connection params as per the 
following example (uses derby in-memory db)

{
:classname org.apache.derby.jdbc.EmbeddedDriver
:subprotocol memory
:subname jdbc:derby:memory:myDB;create=true
:user 
:password 
}

now you can load the config and create a pooled connection as wished

(def ds (datasource (clojure.java.io/as-file db.properties)))

you can obtain a connection using

{:datasource ds}


Cheers
Christian

Am Freitag, 13. September 2013 12:22:47 UTC+2 schrieb Josh Kamau:

 Hello there ;

 I am in desparate need of a clojure.jdbc with a connection pool example. 

 I have googled and the link to github example is broken.

 Please help.

 Thanks.
 Josh


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.java.jdbc connection pool example

2013-09-13 Thread Josh Kamau
Thanks.

I have used C3P0 for now... I will look at tomcat7 pool though

Josh


On Fri, Sep 13, 2013 at 3:19 PM, gixxi 
christian.meichs...@informatik.tu-chemnitz.de wrote:

 Hi Josh,

 I would opt for using Tomcat 7 Pool API -
 http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

 The following code wraps the pool api and provides reading a config file

 (ns foo
   (:require [clojure.java.io :as io])
   (:import [java.io PushbackReader])
   (:gen-class))

 (defn conf [file]
   Reads a config file containing the connection params (url, driver)
   (binding [*read-eval* false]
 (with-open [r (io/reader file)]
   (read (PushbackReader. r)

 (defn datasource [file]
   creates a pooled data source
   (let
 [config (conf file) ds (new org.apache.tomcat.jdbc.pool.DataSource) pp
 (new org.apache.tomcat.jdbc.pool.PoolProperties)]
 (do
   (.setDriverClassName pp (:classname config))
   (.setUrl pp (:subname config))
   (.setUsername pp (:user config))
   (.setPassword pp (:password config))
   (.setTestOnBorrow pp true)
   (.setValidationQuery pp SELECT 1)
   (.setMaxActive pp 5)
   (.setInitialSize pp 1)
   (.setMaxWait pp 1)
   (.setPoolProperties ds pp)
   (identity ds

 create a file dbconnection.ini with you jdbc connection params as per the
 following example (uses derby in-memory db)

 {
 :classname org.apache.derby.jdbc.EmbeddedDriver
 :subprotocol memory
 :subname jdbc:derby:memory:myDB;create=true
 :user 
 :password 
 }

 now you can load the config and create a pooled connection as wished

 (def ds (datasource (clojure.java.io/as-file db.properties)))

 you can obtain a connection using

 {:datasource ds}


 Cheers
 Christian

 Am Freitag, 13. September 2013 12:22:47 UTC+2 schrieb Josh Kamau:

 Hello there ;

 I am in desparate need of a clojure.jdbc with a connection pool example.

 I have googled and the link to github example is broken.

 Please help.

 Thanks.
 Josh

  --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: reference types (var, atom, ref, agent) and add-watch: deterministic order of notification

2013-09-13 Thread Jay Fields
Watch behavior varies a bit by ref type, I believe. You'll probably
want to look into the details of the specific ref type you're using.

for atoms and refs, I believe the watch is done on the thread that's
updating the ref. Since retries can occur you can't really count on
ordering. You could create your own thread to single thread the action
- I've done that in the past with success. While you can't rely on
ordering, having the old and new value to diff might be enough to know
what actions you want to perform in your watch (on your single thread)

for agents, I believe everything will be single threaded and in the
order of agent updates.

On Fri, Sep 13, 2013 at 8:04 AM, gixxi
christian.meichs...@informatik.tu-chemnitz.de wrote:
 Hi,

 i got a question on reference type instances with attached watches.

 Consider a reference type instance R with a watch W attached by (add-watch R
 :watcher #(...)) and

 a n parallel activities committing a transition to R in some monotonic order
 0..n-1.

 Does Clojure ensure that the function calls by the watch dog are executed in
 the very same order? Is it possible to wrap the watch dog notification in a
 synchronisation block?

 Thanks in advance

 Best regards

 Christian

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why is clojure so powerful?

2013-09-13 Thread John Hyaduck
Have you made the free version available yet?  I would like to read it and 
review.  John Hyaduck

On Wednesday, September 4, 2013 5:32:01 PM UTC-4, Tomislav Tomšić wrote:

 I suspect, there are numerous possible ways to answer that question. One 
 can ignore it, others would care to offer superficial, no it isn't, but I 
 guess, few would answer, it is because clojure is the member of the Lisp 
 family of programming languages. Which immediately invites predictable 
 question.


 Why is Lisp so powerful?

 I guesstimate, there are three possible responses on that question. One is 
 to ignore it, second one is to take it as encouragement for further 
 inquiry, and the third one is to say something along the following lines: 
 “It is because of the lists, dummy. Lisp is built on lists.”


 Very well then, why are lists so powerful?


 Yes, there is answer(s), but as I hope we all know, every answer opens the 
 door for new questions and problems. In other words, we have an, hopefully 
 clear and self-understandable, answer to why is Lisp so powerful, but we 
 are now facing numerous, previously unimaginable choices and opportunities 
 to improve Lisp further, which is the reason why I am putting this message 
 here, in the group dedicated to the new and continually improving member of 
 Lisp programming family.


 I hope to solve and clarify as many as I can, but it demands time and 
 other resources, which is why I decided to put answer(s) and reasons for 
 them in a book. It is called “Arrogance of Abstraction”, and it is 
 available through Amazon. Amazon allows, even encourages authors, to put an 
 effort to contact audience. In other words, it will be available for free 
 download from Amazon at following days this month: 2013-09-08 and 
 2013-09-13. I haven't decided yet at what other days will be available for 
 download. If you have an advice, feel free to put it here.


 Thank you for your patience

 Tomislav Tomsic


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Maximize Fantasy Baseball Lineup

2013-09-13 Thread Mark Watson
Hey, newish user here.

I want to make an app that finds the optimal lineup for fantasy baseball 
games.

Each player is assigned a cost, the average points they earn a game, and 
position. For example: Andrew McCutchen, 3.4, 4900, OF

You have to pick one catcher, one pitcher, one first basemen, one second 
basemen, one shortstop, one third basemen, and three outfielders. The catch 
is you also have to stay below a predetermined total cost of your team. I 
want to maximize my total average points while staying under the cost limit.

My plan was to iterate through every possible combo, and swap an atom if I 
find a lineup with a better total average points while staying under the 
total cost limit.

My issues are:

1) This seems like an inelegant solution (brute force)

2) I don't know of a good way to handle the fact that I need to choose 
three outfielders, but can't choose any one outfielder multiple times

Any advice? Thanks!

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Fantasy Baseball Lineup Optimization

2013-09-13 Thread Mark Watson
Hi, newish user here.

I want to make an app that finds a simple, optimized, fantasy baseball 
lineup.

Each player has a cost associated with them, as well as the average points 
per game they score, and position. For example: Mike Napoli, 4600, 2.9, 1B

You have to choose one of each position: catcher, pitcher, 1st base, 2nd 
base, 3rd base, and shortstop. You also have to pick three outfielders. It 
would be easy to just pick the players with the highest points per game, 
but you also need to stay under a specified total cost.

Currently, I iterate through every possibility, and swap an atom with a new 
lineup if the total average points is higher, while staying under the total 
cost limit.

My issues are:

1) This seems like an inelegant solution (brute force)
2) I don't know how to best handle the fact that I need to select three 
outfielders from a single list, and cannot select one player more than once

Any advice, suggestions would be great. Thanks!

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Clojure, floats, ints and OpenGL

2013-09-13 Thread James Reeves
On 13 September 2013 08:54, Mikera mike.r.anderson...@gmail.com wrote:

 Either way, if Clojure's semantics prove to be a fundamental issue for
 performance, then I think it is better to start work to improve Clojure's
 semantics (perhaps targeting 2.0 if we think it's a really big breaking
 change). This would be better, IMHO, than forever accepting semantics that
 prevent idiomatic code from ever being truly fast. I'd rather see a bit of
 breakage and fix my code when upgrading to Clojure 2.0 than be stuck with
 poor performance forever.


Out of curiosity, what is the performance hit in these cases?

Floats obviously save memory, and I believe they're also between 15% to 40%
more efficient for division, at least on Intel CPUs. Is there also a cost
to be paid passing doubles to OpenGL? Do you know what that cost is?

- James

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


bug with '#_' macro as last line?

2013-09-13 Thread m_albert137
Greetings!

First, thanks in advance to anyone looking at this,
and to the good folks that made clojure possible.

Tinkering, I find that if I redirect input so that clojure.main reads
from a file, and the last line is a form that has been commented out
with #_, then I get an error message.

Explicitly, if I try a file like this (the stuff between the '' lines):

(println Hello, world.)
#_ (println Hello, world)


and I then try java -cp '[path]' clojure.main  filename.clj, then the 
first
println succeeds, but I then get an error message:

RuntimeException EOF while reading  clojure.lang.Util.runtimeException 
(Util.java:219).

I'm using clojure 1.5.1 with java 1.7.0_25 on Windows 8 (and cygwin).

Thank you.

Sincerely,
 Mike Albert

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.java.jdbc connection pool example

2013-09-13 Thread Sean Corfield
There are examples in the documentations for both c3p0 and BoneCP:

http://clojure-doc.org/articles/ecosystem/java_jdbc/connection_pooling.html

Note: this is the home for the official java.jdbc documentation so
that it can be augmented by the community, rather than locked in the
java.jdbc repo where only folks with a signed CA can submit
enhancements...

Sean

On Fri, Sep 13, 2013 at 3:22 AM, Josh Kamau joshnet2...@gmail.com wrote:
 Hello there ;

 I am in desparate need of a clojure.jdbc with a connection pool example.

 I have googled and the link to github example is broken.

 Please help.

 Thanks.
 Josh

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] CloCoP - constraint programming for Clojure

2013-09-13 Thread Alex Engelberg
To Daniel's comment: that's a great idea (I'm sorta new to this whole 
releasing-a-library thing so I didn't think of that), and I'll definitely 
make a branch for that if I think of a big idea that I want to implement 
that involves breaking changes. But I figure that if someone other than me 
thinks of something like that, we'll probably discuss it a bit and figure 
something out (rather than just showing up with a pull request).

To Dmitry's comment: I've actually never tried Choco, I essentially chose 
JaCoP because it occured first in my Java Constraint Programming google 
search. Now I'm seeing that a lot of constraint programmers use Choco, and 
I'll try it out. I will point out that JaCoP walked away with some bronze 
and silver medals (with Gecode getting ALL the golds) at the FlatZinc 
challenge. (Choco didn't compete at all, though.)

On Friday, September 13, 2013 12:32:31 AM UTC-7, Dmitry Groshev wrote:

 Great stuff!

 I'm wondering what's the realworld difference between JaCoP and CHOCO. 
 Why did you choose the former?

 On Tuesday, September 10, 2013 5:39:46 AM UTC+4, Alex Engelberg wrote:

 http://github.com/aengelberg/clocop

 CloCoP is a Clojure wrapper of the Java library JaCoP. The acronyms stand 
 for Clojure/Java Constraint Programming. This invites comparison to the 
 core.logic library, and you may wonder why we need both. There are a few 
 ways in which, in my opinion, the JaCoP system is better than core.logic:

- JaCoP is more plug-in-able, with an extensive set of 
customizations to the way that the search operates. There are interfaces 
for different components of the search, and each has several 
implementations. 
- I found that with core.logic, I was somewhat limited by the set of 
available constraints. JaCoP has many different constraints that seem to 
more suit my needs for solving challenging problems. 
- As the core.logic people 
 say,https://github.com/clojure/core.logic/wiki/External-solversJaCoP is 
 anywhere from 10X-100X faster than core.logic at solving Finite 
Domain problems.

 JaCoP has a lot of global constraints which are very powerful and 
 essential for describing certain problems. As Radoslaw Szymanek (an 
 author of JaCoP) says, CP without global constraints is just [a] plain 
 academic toy. Using problems with arithmetic constraints is doing CP bad 
 publicity.

 If you'd like to see implementations of sample problems in CloCoP, check 
 out the test 
 caseshttps://github.com/aengelberg/clocop/tree/master/test/clocop
  (https://github.com/aengelberg/clocop/tree/master/test/clocop).



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why is clojure so powerful?

2013-09-13 Thread Mark C
I see Arrogance of Abstraction can be borrowed free (today only I think) 
by Kindle users with Amazon prime.

On Friday, September 13, 2013 10:36:14 AM UTC-4, John Hyaduck wrote:

 Have you made the free version available yet?  I would like to read it and 
 review.  John Hyaduck

 On Wednesday, September 4, 2013 5:32:01 PM UTC-4, Tomislav Tomšić wrote:

 I suspect, there are numerous possible ways to answer that question. One 
 can ignore it, others would care to offer superficial, no it isn't, but I 
 guess, few would answer, it is because clojure is the member of the Lisp 
 family of programming languages. Which immediately invites predictable 
 question.


 Why is Lisp so powerful?

 I guesstimate, there are three possible responses on that question. One 
 is to ignore it, second one is to take it as encouragement for further 
 inquiry, and the third one is to say something along the following lines: 
 “It is because of the lists, dummy. Lisp is built on lists.”


 Very well then, why are lists so powerful?


 Yes, there is answer(s), but as I hope we all know, every answer opens 
 the door for new questions and problems. In other words, we have an, 
 hopefully clear and self-understandable, answer to why is Lisp so powerful, 
 but we are now facing numerous, previously unimaginable choices and 
 opportunities to improve Lisp further, which is the reason why I am putting 
 this message here, in the group dedicated to the new and continually 
 improving member of Lisp programming family.


 I hope to solve and clarify as many as I can, but it demands time and 
 other resources, which is why I decided to put answer(s) and reasons for 
 them in a book. It is called “Arrogance of Abstraction”, and it is 
 available through Amazon. Amazon allows, even encourages authors, to put an 
 effort to contact audience. In other words, it will be available for free 
 download from Amazon at following days this month: 2013-09-08 and 
 2013-09-13. I haven't decided yet at what other days will be available for 
 download. If you have an advice, feel free to put it here.


 Thank you for your patience

 Tomislav Tomsic



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Clojure, floats, ints and OpenGL

2013-09-13 Thread Timothy Baldridge
 This would be better, IMHO, than forever accepting semantics that
prevent idiomatic code from ever being truly fast.

You're going to have a hard time convincing people to give up some of
the dynamism of Clojure just for the sake of more performance. Especially
considering that many Clojure users are perfectly okay with boxed values,
let alone need floats or other primitives.

But what you are describing creates a whole ton of new problems, problems I
don't see a good solution for. What you are describing would require the
recompilation of entire source trees when a inner function is modified. So
now we're in the Scala/Java land of recompile after every edit. Perhaps
there's a use-case for invoke dynamic here, but now you're talking about
breaking backwards compatibility for everyone not using Java 7+.

I'll be the first to admit that I'd like to rewrite the Clojure compiler as
a true multi-pass optimizing compiler. But that's a task I haven't
undertaken for two reasons 1) it's a ton of work that would take months (if
not years) to reach the level of performance currently offered by Clojure.
2) I really don't need it. Every time I need that level of performance I
drop to Java, CUDA or some other high performance toolkit.

Personally I think it would be much better for someone to come up with a
typed lisp that interops very cleanly with Clojure. That way you can build
your inner kernels using a lisp-like language, and then glue it together
with Clojure.

But let me close by saying, if you really want better primitives, I'd
suggest writing up a proposal for how it would work, perhaps even with some
example using macros and genclass. Until then we don't have anything to go
off of, people say I'd love to have feature X, well we all would, but all
the suggestions thus far won't work, so how do you plan on fixing that?

Timothy


On Fri, Sep 13, 2013 at 1:54 AM, Mikera mike.r.anderson...@gmail.comwrote:

 On Friday, 13 September 2013 12:11:50 UTC+8, tbc++ wrote:

  If we can do away with the interface generation, then support for
 arbitrary primitive arguments should become relatively straightforward.

 How would we even call a function without an interface? Remember
 everything is defined behind vars, so you simply can't assume that a
 function won't be re-defed without notice. This is the reason interfaces
 exist notice how the following works:

 user= (defn foo ^long [^long x] x)
 #'user/foo
 user= (defn baz [x] (foo x))
 #'user/baz
 user= (baz 42)
 42
 user= (defn foo ^double [^double x] x)
 #'user/foo
 user= (baz 42)

 ClassCastException user$foo cannot be cast to clojure.lang.IFn$LL
  user/baz (NO_SOURCE_FILE:1)
 user=


 Good example to discuss!

 I agree there is a subtle tradeoff between performance and dynamism here.

 Any interface dispatch via a var uses an extra level of indirection (in
 the dynamic var case, this includes a thread-local check for any bindings)
 and already adds some overhead. If you are happy using Clojure's dynamic
 features to pass arbitrary (boxed / Object) arguments and redefine vars on
 the fly like that, you probably don't really care about optimal performance
 very much anyway and a standard IFn invoke should be OK.

 For performance-sensitive code, you ideally want primitive-typed code to
 be compiled to a direct method call (invokevirtual) and not go via any var
 lookup / interface invoke at all. This would mean you would also need to
 redefine/recompile baz if you wanted to use a changed version of foo, but
 that's a relatively minor inconvenience IMHO. If you redefine baz after
 redefining foo (e.g. by reloading the whole namespace), then everything
 will still work. I'm not sure if it is possible to get this precise
 behaviour in Clojure at present - but it would certainly be great for high
 performance code.

 If we want *both* maximum performance and dynamic flexibility, then I
 think we need a completely different approach. Clojure vars as currently
 designed won't cut it. Probably something like an on-demand re-compilation
 strategy based on a var dependency graph would be needed. I personally
 think that's the right long-term direction, but that's definitely Clojure
 2.0 territory.



 Do a prototype with definterface/genclass or something and then report
 your results. My suspicions are that you'll find doing this without
 interfaces, while maintaining Clojure's semantics, is impossible.


 You may be right. Though it also probably depends on what you consider
 documented (promised not to change in public API) vs. undocumented
 (implementation detail) semantics. Some of the subtleties on what happens
 to existing code when you redefine vars are arguably in the latter
 category. Observe:

 (defn foo ^double [^double x] (inc x))
 (defn baz [x] (foo x))
 (baz 42)
 = 43.0
 (ns-unmap *ns* 'foo)
 (defn foo ^double [^double x] (dec x))
 (baz 42)
 = 43.0

 i.e. it's fairly easy to trick Clojure into keeping an old version of a
 var around. Does that count as officially 

clojure web framework

2013-09-13 Thread Jon Barker
anybody know the easiest way to create web applications and deploy to 
amazon web services?  (either EC2 or elastic beanstalk)

Thanks,
Jon

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] quickie- autotest plugin for clojure.test

2013-09-13 Thread Christopher Allen
Link:

https://github.com/jakepearson/quickie

Is it possible to see *some* of the stack trace so you can debug?

Also you should include a screenshot of what the library looks like in 
action. :)


On Friday, September 13, 2013 10:57:35 AM UTC-7, Jake Pearson wrote:

 Hi,
 Quickie is a leiningen plugin to autotest clojure.test tests.  There don't 
 seem to be any active projects for clojure.test, so a couple of people at 
 my office wrote one.  Please let me know if you have any problems or ideas:

- Uses the builtin clojure.test test runner so you don't need to 
rewrite your tests
- Tools.namespace will unload and reload namespaces as needed to keep 
process in sync
- Runs every time a clojure file in your project changes
- Uses (Clansi)[https://github.com/ams-clj/clansi] to show a red or 
green bar to know if you tests are passing
- Filters out exception stacktraces to remove cruft

 thanks,
 Jake


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANN] quickie- autotest plugin for clojure.test

2013-09-13 Thread Jake Pearson
Hi,
Quickie is a leiningen plugin to autotest clojure.test tests.  There don't 
seem to be any active projects for clojure.test, so a couple of people at 
my office wrote one.  Please let me know if you have any problems or ideas:

   - Uses the builtin clojure.test test runner so you don't need to rewrite 
   your tests
   - Tools.namespace will unload and reload namespaces as needed to keep 
   process in sync
   - Runs every time a clojure file in your project changes
   - Uses (Clansi)[https://github.com/ams-clj/clansi] to show a red or 
   green bar to know if you tests are passing
   - Filters out exception stacktraces to remove cruft

thanks,
Jake

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] quickie- autotest plugin for clojure.test

2013-09-13 Thread Jake Pearson
Hi,
I added a screenshot to the readme.  I think in general filtering items 
from the stacktrace is a good idea, but I am probably doing it too much.  I 
have an idea.  I will work on it this weekend.

thanks,
Jake

On Friday, September 13, 2013 12:21:00 PM UTC-6, Christopher Allen wrote:

 Link:

 https://github.com/jakepearson/quickie

 Is it possible to see *some* of the stack trace so you can debug?

 Also you should include a screenshot of what the library looks like in 
 action. :)


 On Friday, September 13, 2013 10:57:35 AM UTC-7, Jake Pearson wrote:

 Hi,
 Quickie is a leiningen plugin to autotest clojure.test tests.  There 
 don't seem to be any active projects for clojure.test, so a couple of 
 people at my office wrote one.  Please let me know if you have any problems 
 or ideas:

- Uses the builtin clojure.test test runner so you don't need to 
rewrite your tests
- Tools.namespace will unload and reload namespaces as needed to keep 
process in sync
- Runs every time a clojure file in your project changes
- Uses (Clansi)[https://github.com/ams-clj/clansi] to show a red or 
green bar to know if you tests are passing
- Filters out exception stacktraces to remove cruft

 thanks,
 Jake



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure web framework

2013-09-13 Thread Christopher Allen
Well for creation itself, http://www.luminusweb.net/ represents best 
practices with Ring, Compojure, and the usual attendant libraries.

For deployment, I'd say something like Fabric or Ansible is going to be the 
simplest way to start.

On Friday, September 13, 2013 10:45:10 AM UTC-7, Jon Barker wrote:

 anybody know the easiest way to create web applications and deploy to 
 amazon web services?  (either EC2 or elastic beanstalk)

 Thanks,
 Jon


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANN] LispCast Introduction to Clojure Videos

2013-09-13 Thread Eric Normand
Hi all!

I announced the Kickstarter project here way back in February and got a 
good response. I thought you might want to know that the videos are 
available for sale.

http://videos.lispcast.com

The target audience is people who are very new to Lisp. It begins with 
opening and closing parens :) and ends with data-driven programming. The 
point is to show how powerful programming with data can be.

At the moment, I am selling them for $12 with no DRM. The price may 
increase soon on advice from several people.

Enjoy!
Eric

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How does ! order results from async?

2013-09-13 Thread larry google groups

I am stupid and recursion is clearly beyond my intellect. Martin Trojer has 
a great blog post here which I learned a lot from but I don't understand 
why the final example works:

http://martintrojer.github.io/clojure/2013/07/17/non-tailrecursive-functions-in-coreasync/

He offers this as an example of recursively walking a binary search tree:

(defn walk [tree ch]
  (letfn [(walker [t]
(go
 (when t
   (walker (:left t))
   (! ch (:value t))
   (walker (:right t)]
(go
 (! (walker tree))
 (close! ch

and then he writes:

This looks promising, but the results in the channel can be in any order 
(since there are no order guarantees in the scheduling of go processes) – this 
also means that some of the values might be missing since the “top” go process 
can be scheduled before a child one. We need a little bit more synchronisation 
to arrive at a working solution.


and then offers this as the final working example:

(defn walk [tree ch]
  (letfn [(walker [t]
(go
 (when t
   (! (walker (:left t)))
   (! ch (:value t))
   (! (walker (:right t))]
(go
 (! (walker tree))
 (close! ch

I am confused what this line does:

   (! (walker (:left t)))

It looks like we are pulling a value off channel that's returned from that call 
to walker? But why? We seem to be throwing this value away? I don't see it 
being stored anywhere. 

How does this give us synchronization?  

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] clojuretip.herokuapp.com

2013-09-13 Thread Ruslan Prokopchuk
I've created new app with the same name using github source. Thanks a lot, 
Steven!

On Thursday, September 12, 2013 9:44:18 PM UTC+3, Ruslan Prokopchuk wrote:

 Oh, where this awesomeness has been lost today? Heroku replies: 
 *No such app*
 On Saturday, September 7, 2013 8:09:06 PM UTC+3, Steven Degutis wrote:

 Yesterday in #clojure:

 TimMc To get your random API learnin' of the day, just run: (- 
 clojure.core quote the-ns ns-publics seq rand-nth val meta ((juxt :name 
 :doc)) (map println) dorun)

 Awesome, right? So I put a lil web wrapper around it and uploaded it to 
 clojuretip.herokuapp.com and https://github.com/sdegutis/clojuretip.

 -Steven



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] quickie- autotest plugin for clojure.test

2013-09-13 Thread Alexandr Kurilin
Thanks for putting this plugin together, very useful!

A couple of remarks:

   - Seems to the advantage over aphyr/prism in terms of not forcing you to
   use the foo-test convention, for those of us who are keeping same names as
   the namespaces in the test/ folder. It's possible I'm being non-idiomatic
   here and I should suffix tests with -test instead.
   - Looks like it's not running under the test leiningen profile. In my
   case, I suppress a lot of logging in test mode to keep lein test output
   readable, and quickie bypasses that. I'm not sure if perhaps I'm just not
   logging things the right way and this is a wontfix.
   - Would be very neat if it re-ran only the tests that changed, or whose
   corresponding namespace contents changed.

Thanks!


On Fri, Sep 13, 2013 at 12:36 PM, Jake Pearson jpear...@rallydev.comwrote:

 Hi,
 I added a screenshot to the readme.  I think in general filtering items
 from the stacktrace is a good idea, but I am probably doing it too much.  I
 have an idea.  I will work on it this weekend.

 thanks,
 Jake


 On Friday, September 13, 2013 12:21:00 PM UTC-6, Christopher Allen wrote:

 Link:

 https://github.com/**jakepearson/quickiehttps://github.com/jakepearson/quickie

 Is it possible to see *some* of the stack trace so you can debug?

 Also you should include a screenshot of what the library looks like in
 action. :)


 On Friday, September 13, 2013 10:57:35 AM UTC-7, Jake Pearson wrote:

 Hi,
 Quickie is a leiningen plugin to autotest clojure.test tests.  There
 don't seem to be any active projects for clojure.test, so a couple of
 people at my office wrote one.  Please let me know if you have any problems
 or ideas:

- Uses the builtin clojure.test test runner so you don't need to
rewrite your tests
- Tools.namespace will unload and reload namespaces as needed to
keep process in sync
- Runs every time a clojure file in your project changes
- Uses 
 (Clansi)[https://github.com/**ams-clj/clansihttps://github.com/ams-clj/clansi]
to show a red or green bar to know if you tests are passing
- Filters out exception stacktraces to remove cruft

 thanks,
 Jake

  --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Alexandr Kurilin - Front Row Education (www.frontrowed.com)
206.687.8740 | a...@kurilin.net
@alex_kurilin

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Maximize Fantasy Baseball Lineup

2013-09-13 Thread Norman Richards
This sounds like a classic knapsack problem.  For such a small problem
space, a simple dynamic programming solution would suffice.


If you are interested in exploring this problem at a larger scale, I high
recommend coursera's Discrete Optimization class:

https://class.coursera.org/optimization-001

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure web framework

2013-09-13 Thread Anton Podviaznikov
Hi John,

It's super easy to deploy Clojure web app (ring) to Amazon Beanstalk. I 
think there were few blog posts about that.

Basically you just need https://github.com/weavejester/lein-beanstalk

Anton

On Friday, September 13, 2013 2:45:10 PM UTC-3, Jon Barker wrote:

 anybody know the easiest way to create web applications and deploy to 
 amazon web services?  (either EC2 or elastic beanstalk)

 Thanks,
 Jon


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


clojure.java.jdbc connection pool example

2013-09-13 Thread Daniel
I believe Korma uses c3p0 for connection pooling right out of the box.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How does ! order results from async?

2013-09-13 Thread Cedric Greevey
It forces the go block to wait until (walker (:left t)) pushes something --
that is, for the recursively-entered go block to complete. Similarly the
right branch is waited for before the parent go block completes. So forcing
an in-order traversal of the tree.


On Fri, Sep 13, 2013 at 5:13 PM, larry google groups 
lawrencecloj...@gmail.com wrote:


 I am stupid and recursion is clearly beyond my intellect. Martin Trojer
 has a great blog post here which I learned a lot from but I don't
 understand why the final example works:


 http://martintrojer.github.io/clojure/2013/07/17/non-tailrecursive-functions-in-coreasync/

 He offers this as an example of recursively walking a binary search tree:

 (defn walk [tree ch]
   (letfn [(walker [t]
 (go
  (when t
(walker (:left t))
(! ch (:value t))
(walker (:right t)]
 (go
  (! (walker tree))
  (close! ch

 and then he writes:

 This looks promising, but the results in the channel can be in any order 
 (since there are no order guarantees in the scheduling of go processes) – 
 this also means that some of the values might be missing since the “top” go 
 process can be scheduled before a child one. We need a little bit more 
 synchronisation to arrive at a working solution.


 and then offers this as the final working example:

 (defn walk [tree ch]
   (letfn [(walker [t]
 (go
  (when t
(! (walker (:left t)))
(! ch (:value t))
(! (walker (:right t))]
 (go
  (! (walker tree))
  (close! ch

 I am confused what this line does:

(! (walker (:left t)))

 It looks like we are pulling a value off channel that's returned from that 
 call to walker? But why? We seem to be throwing this value away? I don't see 
 it being stored anywhere.

 How does this give us synchronization?

  --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.