Re: ANN: contrib-repl

2012-12-03 Thread Laurent PETIT
2012/12/4 rob :
> That was my first thought, and considered also generating a project.clj, but
> after thinking about it I decided I didn't want to encourage this type of
> behavior beyond REPL experimentation, so I preferred to do it in a way that
> focuses on the REPL.

Hi,

Really appreciate that you did it as library, and also as an nrepl
middleware, so that this interesting piece of code is not stuck to a
particular tool !

That said, I think the middleware, with the facility of automatically
loading the libs at nrepl server startup time, is interesting !

A few questions:

- if some of the contrib dependencies are already marked as deps in
the project, how does that work ? What about version conflicts ?
- it would be interesting to do the other way around? instead of
having the middleware automagically import libraries that may or may
not be of use, why not have a lein+nrepl middleware combo that
automatically loads all the 'direct' dependencies declared in the
current profile (no more, no less), with an option to also
automatically load all the 'transitive' dependencies as well? => Would
seem less magic, and also less fragile when facing version
compatibility issues, etc. ?

>
>
> On Tuesday, December 4, 2012 2:24:38 AM UTC-5, Meikel Brandmeyer (kotarak)
> wrote:
>>
>> Hi,
>>
>> may I suggest a different solution? Create a meta project, which just
>> depends on all the contrib libraries and specify this as a dependency in
>> your project. In other parts of the world this is called a "BOM" - a bill of
>> material.
>>
>> 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

-- 
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: contrib-repl

2012-12-03 Thread rob
That was my first thought, and considered also generating a project.clj, 
but after thinking about it I decided I didn't want to encourage this type 
of behavior beyond REPL experimentation, so I preferred to do it in a way 
that focuses on the REPL.

On Tuesday, December 4, 2012 2:24:38 AM UTC-5, Meikel Brandmeyer (kotarak) 
wrote:
>
> Hi,
>
> may I suggest a different solution? Create a meta project, which just 
> depends on all the contrib libraries and specify this as a dependency in 
> your project. In other parts of the world this is called a "BOM" - a bill 
> of material.
>
> 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

Re: ANN: contrib-repl

2012-12-03 Thread Meikel Brandmeyer (kotarak)
Hi,

may I suggest a different solution? Create a meta project, which just 
depends on all the contrib libraries and specify this as a dependency in 
your project. In other parts of the world this is called a "BOM" - a bill 
of material.

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

ANN: contrib-repl

2012-12-03 Thread Robert Levy
John Aspden posted an interesting question on Stack Overflow about adding
all of the latest versions of contrib libraries as dependencies in a REPL
session.  The question and my response can be found here:
http://stackoverflow.com/questions/13673094/how-do-i-depend-on-every-clojure-contrib-library/13676638

Since this solution might be generally useful, I have packaged it as a
library that can either be used as nREPL middleware or invoked manually in
an already-running REPL.  The code, usage instructions, and sample project
demonstrating the middleware usage can be found at
https://github.com/rplevy/contrib-repl

contrib-repl

nREPL middleware to look up the latest versions of all Clojure contrib
libraries and add them as dependencies. Can also be used manually in an
already-running REPL.
UsageOption
A. Use as nREPL middleware

Edit project.clj:

  :dependencies [[rplevy/contrib-repl "0.1.0"]]
  :repl-options {:nrepl-middleware [contrib-repl.middleware/add-contrib-deps]}

Then run lein repl to enter a repl with all contrib dependencies added.
Option
B. Invoke from an already running REPL

In a REPL session:

(require '[cemerick.pomegranate :as pom])(pom/add-dependencies
:coordinates '[[rplevy/contrib-repl "0.1.0"]]
  :repositories {"clojars"
"http://clojars.org/repo"})(require '[contrib-repl.manually :refer
[add-contrib-deps]])(add-contrib-deps) ; add all of the contrib
libraries
You can also add just a subset of the contrib libraries:
(add-contrib-deps ["tools.nrepl" "core.match"]) ; only add these libraries

License

Copyright © 2012 Robert P. Levy

Distributed under the Eclipse Public License, the same as 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: clojurescript browser repl possible regression

2012-12-03 Thread Brent Millare
https://github.com/downloads/bmillare/dj.web.browser/minimal.tar.gz

@Mimmo, I don't use cljsbuild as thats mainly for automation that doesn't 
fit my use cases. Instead I am using the github clojurescript docs for this 
reference project. Normally, I use my own build tools.

I created a minimal project, you can just run the steps.sh script (and 
follow the comments) to reproduce the error. I assume you are running this 
on linux.

Also another thing I forgot to mention, after loading the url, the repl 
spits out errors:

ClojureScript:cljs.user> Dec 03, 2012 8:50:33 PM 
com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: 
file:/home/bmillare/dj/usr/src/minimal/clojurescript/lib/goog.jar!/goog/net/xpc/crosspagechannel.js:26:
 
ERROR - required "goog.async.Deferred" namespace never provided
goog.require('goog.async.Deferred');
^

Dec 03, 2012 8:50:33 PM com.google.javascript.jscomp.LoggerErrorManager 
println
SEVERE: 
file:/home/bmillare/dj/usr/src/minimal/clojurescript/lib/goog.jar!/goog/net/xpc/nativemessagingtransport.js:26:
 
ERROR - required "goog.async.Deferred" namespace never provided
goog.require('goog.async.Deferred');
^

Dec 03, 2012 8:50:33 PM com.google.javascript.jscomp.LoggerErrorManager 
printSummary
WARNING: 2 error(s), 0 warning(s)
ERROR: JSC_MISSING_PROVIDE_ERROR. required "goog.async.Deferred" namespace 
never provided at 
file:/home/bmillare/dj/usr/src/minimal/clojurescript/lib/goog.jar!/goog/net/xpc/crosspagechannel.js
 
line 26 : 0
ERROR: JSC_MISSING_PROVIDE_ERROR. required "goog.async.Deferred" namespace 
never provided at 
file:/home/bmillare/dj/usr/src/minimal/clojurescript/lib/goog.jar!/goog/net/xpc/nativemessagingtransport.js
 
line 26 : 0


On Monday, December 3, 2012 7:50:11 PM UTC-5, David Nolen wrote:
>
> Please create a minimal project that demonstrates the issue for you, then 
> we can try to run that.
>
>
> On Tue, Dec 4, 2012 at 12:02 AM, Brent Millare 
> 
> > wrote:
>
>> Still getting the same error regardless.
>>
>> 1. creating index.html (with compiled cljs code and call to connect) and 
>> putting in clojurescript directory
>> 2. starting up clojurescript clojure repl with ./script/repl
>> 3. Running the clojurescript repl with:
>> (require '[cljs.repl :as repl])
>> (require '[cljs.repl.browser :as browser])  ;; require the browser 
>> implementation of IJavaScriptEnv
>> (def env (browser/repl-env)) ;; create a new environment
>> (repl/repl env) ;; start the REPL
>> 4. Point browser to "http://localhost:9000";
>>
>> I get the "clojure is not defined error", and clojurescript repl is still 
>> unresponsive (since connection wasn't completed). The compiling step is 
>> fine and the clojurescript code before the call to connect works.
>>
>>
>>
>> On Monday, December 3, 2012 6:22:24 PM UTC-5, David Nolen wrote:
>>>
>>> file:// urls don't work anymore due to changes in the Google Closure 
>>> Library. You need to point your browser to http://localhost:9000/, by 
>>> default it looks for index.html.
>>>
>>> David
>>>
>>>  -- 
>> 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
>>
>
>

-- 
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: cljs-uuid-utils (Re: CLJS: UUID generator for ClojureScript)

2012-12-03 Thread Frank Siebenlist
Added a "uuid-string" getter function to obtain a string representation of a 
UUID-instance, which makes for easier interop with apps that require such a 
uuid-string, like web-app, json, databases (i.e. legacy apps that have not been 
made EDN-aware yet ;-) )

(thanks to Robert Stuttaford for the idea!)

Bumped version to [cljs-uuid-utils "0.1.3"]

-FS.


On Dec 2, 2012, at 6:36 PM, Frank Siebenlist  wrote:

> I've wrapped my random uuid generator up in a little library at:
> 
> https://github.com/franks42/cljs-uuid-utils
> 
> ---
> cljs-uuid-utils
> 
> ClojureScript micro-library with an implementation of a type 4, random UUID 
> generator compatible with RFC-4122 and cljs.core/UUID (make-random-uuid), a 
> uuid-string conformance validating predicate (valid-uuid?), and a UUID 
> factory from uuid-string with conformance validation (make-uuid-from).
> ---
> 
> As mentioned before, clojure on the jvm can leverage the ubiquitous 
> "java.util.UUID/randomUUID", while there is no generally available random 
> uuid generator in the javascript world. Although this micro-lib addresses 
> that issue somewhat, I believe that we should have a random-uuid generator as 
> part of the batteries-included cljs-distro. 
> 
> Another issue that I came across is the fact that the 
> java.util.UUID/fromString does do a conformance check of the presented 
> uuid-string, and throws an exception if it does not pass. ClojureScript's 
> reader yields a cljs.core/UUID instance for uuid-literals, but doesn't check 
> for any conformance and essentially accepts any string. This could lead to 
> interesting, surprising bugs during cljs-clj interop. 
> 
> Please let me know if you use this little library, and any 
> suggestions/comments for improvement are always welcome.
> 
> Enjoy, FrankS.
> 
> 
> 
> On Nov 29, 2012, at 10:20 AM, David Nolen  wrote:
> 
>> Also note that testing with the Rhino REPL is not informative about 
>> performance in anyway - you absolutely need to test your code against the 
>> modern JS engines - V8, JavaScriptCore, or SpiderMonkey (with JIT turned 
>> on). For code like this they are often 100X faster if not far greater than 
>> that.
>> 
>> 
>> On Thu, Nov 29, 2012 at 1:07 PM, Frank Siebenlist 
>>  wrote:
>> Thanks for the feedback!
>> 
>> Defining the two helper functions outside of the function-scope doesn't seem 
>> to have any effect on the performance numbers.
>> 
>> …but I have to confess that all testing was done at the repl without any 
>> optimization so far…
>> 
>> -FS.
>> 
>> 
>> 
>> On Nov 29, 2012, at 8:36 AM, David Nolen  wrote:
>> 
>>> Oh though before you lift them out by hand - I would double check that 
>>> :simple optimizations doesn't already do this for you :)
>>> 
>>> 
>>> On Thu, Nov 29, 2012 at 1:25 AM, Frank Siebenlist 
>>>  wrote:
>>> I need UUIDs in my CLJS code…
>>> 
>>> cljs.core does include a UUID type, but no generator.
>>> 
>>> I found a couple of efforts and example code at 
>>> https://github.com/davesann/cljs-uuid and 
>>> http://catamorphic.wordpress.com/2012/03/02/generating-a-random-uuid-in-clojurescript,
>>> but they didn't work with cljs.core/UUID or were too slow.
>>> 
>>> There are many javascript versions out there, but that would require 
>>> another external js-lib.
>>> (really surpising that I couldn't find a UUID generator in closure-lib…)
>>> 
>>> Please take a look at my UUID-playground at 
>>> "https://gist.github.com/4159427";,
>>> which includes a few implementations with some rudimentary timing results.
>>> 
>>> Appreciate any comments or suggestions, or maybe a pointer to a faster, 
>>> cleaner implementation...
>>> 
>>> Thanks, FrankS.
>>> 
>>> PS. I would think that the cljs-community would love to have a UUIDv4 
>>> generator as part of the clojurescript distro...
>>> 
>>> 
>>> --
>>> 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
>> 
>> --
>> 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 unsubsc

Re: clojurescript browser repl possible regression

2012-12-03 Thread David Nolen
Please create a minimal project that demonstrates the issue for you, then
we can try to run that.


On Tue, Dec 4, 2012 at 12:02 AM, Brent Millare wrote:

> Still getting the same error regardless.
>
> 1. creating index.html (with compiled cljs code and call to connect) and
> putting in clojurescript directory
> 2. starting up clojurescript clojure repl with ./script/repl
> 3. Running the clojurescript repl with:
> (require '[cljs.repl :as repl])
> (require '[cljs.repl.browser :as browser])  ;; require the browser
> implementation of IJavaScriptEnv
> (def env (browser/repl-env)) ;; create a new environment
> (repl/repl env) ;; start the REPL
> 4. Point browser to "http://localhost:9000";
>
> I get the "clojure is not defined error", and clojurescript repl is still
> unresponsive (since connection wasn't completed). The compiling step is
> fine and the clojurescript code before the call to connect works.
>
>
>
> On Monday, December 3, 2012 6:22:24 PM UTC-5, David Nolen wrote:
>>
>> file:// urls don't work anymore due to changes in the Google Closure
>> Library. You need to point your browser to http://localhost:9000/, by
>> default it looks for index.html.
>>
>> 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

CLJS: Q about the js-code downloaded by the browser REPL connection...

2012-12-03 Thread Frank Siebenlist
David mentioned in another thread that "… the file that's meant to be loaded 
into the cross page iframe…"

I noticed that before, but it always puzzled me - time to ask the Q.

Could someone please explain why the REPL downloads essentially the same 
js-code when it connects as the js-code that came down with the webpage?

(Believe I disabled the download once 2 months ago, and pretty much all worked 
as before…)

Confusingly yours, FrankS.

-- 
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: clojurescript browser repl possible regression

2012-12-03 Thread Mimmo Cosenza
Have you tried using lein-cljsbuild "0.2.9" plugin without specifying any CLJS 
version in the :dependencies?

mimmo

On Dec 4, 2012, at 1:02 AM, Brent Millare  wrote:

> Still getting the same error regardless.
> 
> 1. creating index.html (with compiled cljs code and call to connect) and 
> putting in clojurescript directory
> 2. starting up clojurescript clojure repl with ./script/repl
> 3. Running the clojurescript repl with:
> (require '[cljs.repl :as repl])
> (require '[cljs.repl.browser :as browser])  ;; require the browser 
> implementation of IJavaScriptEnv
> (def env (browser/repl-env)) ;; create a new environment
> (repl/repl env) ;; start the REPL
> 4. Point browser to "http://localhost:9000";
> 
> I get the "clojure is not defined error", and clojurescript repl is still 
> unresponsive (since connection wasn't completed). The compiling step is fine 
> and the clojurescript code before the call to connect works.
> 
> 
> 
> On Monday, December 3, 2012 6:22:24 PM UTC-5, David Nolen wrote:
> file:// urls don't work anymore due to changes in the Google Closure Library. 
> You need to point your browser to http://localhost:9000/, by default it looks 
> for index.html.
> 
> 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: Easy update function for nested structures

2012-12-03 Thread JvJ
OK thanks.  I guess that's sufficiently terse.  I was just wondering if 
there was a single built-in function for it.

On Monday, 3 December 2012 17:37:04 UTC-5, Las wrote:
>
> Hi,
>
> how about
>
> (reduce #(update-in % %2 tf) arr2d list-of-coordinates)
>
> given you 2d array is a vector of vectors  and you supply a tf update 
> function?
>
> Las
>
> 2012/12/3 JvJ >
>
>> I'm wondering if there's something that can be used like update-in, but 
>> with multiple key-lists and values.
>>
>> Like, for example, taking a list of [x y] coordinates for a 2-dimensional 
>> array, and changing the values at all of those coordinates. 
>>
>> -- 
>> 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
>
>
>
>
> -- 
> László Török
>
> 

-- 
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: clojurescript browser repl possible regression

2012-12-03 Thread Brent Millare
Still getting the same error regardless.

1. creating index.html (with compiled cljs code and call to connect) and 
putting in clojurescript directory
2. starting up clojurescript clojure repl with ./script/repl
3. Running the clojurescript repl with:
(require '[cljs.repl :as repl])
(require '[cljs.repl.browser :as browser])  ;; require the browser 
implementation of IJavaScriptEnv
(def env (browser/repl-env)) ;; create a new environment
(repl/repl env) ;; start the REPL
4. Point browser to "http://localhost:9000";

I get the "clojure is not defined error", and clojurescript repl is still 
unresponsive (since connection wasn't completed). The compiling step is 
fine and the clojurescript code before the call to connect works.



On Monday, December 3, 2012 6:22:24 PM UTC-5, David Nolen wrote:
>
> file:// urls don't work anymore due to changes in the Google Closure 
> Library. You need to point your browser to http://localhost:9000/, by 
> default it looks for index.html.
>
> 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: clojurescript browser repl possible regression

2012-12-03 Thread David Nolen
file:// urls don't work anymore due to changes in the Google Closure
Library. You need to point your browser to http://localhost:9000/, by
default it looks for index.html.

David


On Mon, Dec 3, 2012 at 10:05 PM, Brent Millare wrote:

> At the moment, all I am doing is dragging and dropping the html file into
> the browser, which contains the compiled clojurescript (js) which looks
> like this
>
> view.html
>
> ... compiled cljs stuff ...
> 
> foo.main();
> 
> ...
>
> Where foo.cljs is:
> (ns foo (:require [clojure.browser.repl]))
> (defn main [] (clojure.browser.repl/connect "http://localhost:9000/repl";))
>
> hence, the url is like
> file:///home/.../out/view.html
>
> Again only the error message says repl:3
>
>
> On Monday, December 3, 2012 4:29:43 PM UTC-5, David Nolen wrote:
>>
>> It sounds like you are trying to navigate to 
>> http://localhost:9000/replthough right? You should be navigating to
>> http://localhost:9000/
>>
>>
>>
>>  --
> 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

Allowed characters in namespaces

2012-12-03 Thread James Reeves
I've noticed that the "+" character can be used in namespaces without 
seeming to cause any issues, e.g.

(ns app.view.posts+comments)

This also appears to work fine when there is AOT compilation, with the 
symbol being munged in the same way a function name would be.

Is it a good idea to create a namespace like this? If namespaces are 
allowed all the characters of a symbol, then the EDN spec would suggest 
this is a permitted namespace name. However, I haven't seen this style of 
namespace before.

>From a purely aesthetic standpoint, "posts+comments" seems a nice way of 
denoting the name of a composite view.

- 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

Re: Easy update function for nested structures

2012-12-03 Thread László Török
Hi,

how about

(reduce #(update-in % %2 tf) arr2d list-of-coordinates)

given you 2d array is a vector of vectors  and you supply a tf update
function?

Las

2012/12/3 JvJ 

> I'm wondering if there's something that can be used like update-in, but
> with multiple key-lists and values.
>
> Like, for example, taking a list of [x y] coordinates for a 2-dimensional
> array, and changing the values at all of those coordinates.
>
> --
> 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




-- 
László Török

-- 
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: clojurescript browser repl possible regression

2012-12-03 Thread Brent Millare
At the moment, all I am doing is dragging and dropping the html file into 
the browser, which contains the compiled clojurescript (js) which looks 
like this

view.html

... compiled cljs stuff ...

foo.main();

...

Where foo.cljs is:
(ns foo (:require [clojure.browser.repl]))
(defn main [] (clojure.browser.repl/connect "http://localhost:9000/repl";))

hence, the url is like
file:///home/.../out/view.html

Again only the error message says repl:3

On Monday, December 3, 2012 4:29:43 PM UTC-5, David Nolen wrote:
>
> It sounds like you are trying to navigate to http://localhost:9000/replthough 
> right? You should be navigating to 
> http://localhost:9000/
>
>
>
>

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

Easy update function for nested structures

2012-12-03 Thread JvJ
I'm wondering if there's something that can be used like update-in, but 
with multiple key-lists and values.

Like, for example, taking a list of [x y] coordinates for a 2-dimensional 
array, and changing the values at all of those coordinates.

-- 
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: understanding 'binding' use in clojure.java.jdbc

2012-12-03 Thread Sean Corfield
FWIW, the c.j.jdbc docs have an example of connection pooling:

http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/ConnectionPooling.html


On Mon, Dec 3, 2012 at 6:03 AM, Matthias Cords wrote:

> Hi,
>
> I found database connection pools to be the right thing to use with
> c.j.jdbc and multiple databases.
>
> https://clojars.org/org.bituf/clj-dbcp
>
> (let [conn1 (make-pool-1)
>   conn2 (make-pool-2)]
>   (sql/with-connection conn1
> (sql/with-query-results r ["select ..."]
>   (sql/with-connection conn2
> (sql/do-commands "insert into ...")
>
> matt
>
>
>
> On 10 October 2012 15:03, Stuart Sierra wrote:
>
>>
>>
>> On Tuesday, October 9, 2012 10:25:05 PM UTC-4, Sean Corfield wrote:
>>>
>>> This is why c.j.jdbc is getting an API overall that will expose
>>> functions that accept the connection or the db-spec directly (and the old
>>> API will be rewritten in terms of the new one for compatibility).
>>
>>
>> Excellent.
>> -S
>>
>>  --
>> 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
>



-- 
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: clojurescript browser repl possible regression

2012-12-03 Thread David Nolen
It sounds like you are trying to navigate to
http://localhost:9000/replthough right? You should be navigating to
http://localhost:9000/


On Mon, Dec 3, 2012 at 8:51 PM, Brent Millare wrote:

> The file with the clojurescript and call to connect isn't named repl, its
> named view.html. repl is the name of the response from the call (repl/connect
> "http://localhost:9000/repl";)
>
>
> On Monday, December 3, 2012 3:29:13 PM UTC-5, David Nolen wrote:
>>
>> Don't call your file repl.* this has special meaning - it's the file
>> that's meant to be loaded into the cross page iframe.
>>
>>
>>  --
> 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: clojurescript browser repl possible regression

2012-12-03 Thread Brent Millare
The file with the clojurescript and call to connect isn't named repl, its 
named view.html. repl is the name of the response from the call (repl/connect 
"http://localhost:9000/repl";)

On Monday, December 3, 2012 3:29:13 PM UTC-5, David Nolen wrote:
>
> Don't call your file repl.* this has special meaning - it's the file 
> that's meant to be loaded into the cross page iframe.
>
>
>

-- 
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: clojurescript browser repl possible regression

2012-12-03 Thread David Nolen
Don't call your file repl.* this has special meaning - it's the file that's
meant to be loaded into the cross page iframe.

On Monday, December 3, 2012, Brent Millare wrote:

> I've already tried both ways. Creating the html file with the script tag
> with the simple code you showed, and just simply trying to connect directly
> with http://localhost:9000/repl. In both cases, the same error message
> shows. Note that the error message isn't from my source code, but rather
> from the source code returned by http://localhost:9000/repl
>
> On Monday, December 3, 2012 2:27:29 PM UTC-5, Herwig Hochleitner wrote:
>>
>> The browser repl works by creating a clojurescript file like:
>>
>> (ns foo (:require [clojure.browser.repl :as repl]))
>>
>> (repl/connect "http://localhost:9000/repl";)
>>
>> then compiling it (not in advanced mode) and using the output in a script
>> tag.
>>
>>
>> 2012/12/3 Brent Millare 
>>
>>> Using clojurescript **3842d3f9e0d68853077117a919**e93e169079
>>>
>>> Trying to do the simplest case of a clojurescript browser repl:
>>>
>>> running clojurescript/script/repl, then
>>>
>>> Taken straight from the documentation:
>>>
>>> (require '[cljs.repl :as repl])(require '[cljs.repl.browser :as browser])  
>>> ;; require the browser implementation of IJavaScriptEnv(def env 
>>> (browser/repl-env
>>>
>>>  --
>>> 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
>>
>>
>>  --
> 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 '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  'clojure%2bunsubscr...@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: confused about the scope of variables, or is it something else? ClojureScript

2012-12-03 Thread Arash Bizhan zadeh
So what should I do? would using fmap helps? 
I have used let initially, but I moved away to make it as close as possible 
to my repl code/.


On Sunday, December 2, 2012 8:31:55 PM UTC-5, Sean Corfield wrote:
>
> Part of it is laziness: map is lazy so it doesn't do anything unless you 
> use the result. In the REPL, you print the result so map runs across the 
> whole sequence. In the function, only the last expression (draggables) is 
> returned so it is the only thing fully evaluated.
>
> Your code is very procedural tho'... you should not have 'def' anywhere 
> except the top-level (since it always creates top-level definitions - 
> globals). You probably want 'let' for local definitions. Since you want 
> non-lazy behavior, you're not going to want 'for' or 'map' - look at 
> 'doseq' instead.
>
> Hope that helps? 
>
>
> On Sun, Dec 2, 2012 at 5:25 PM, Arash Bizhan zadeh 
> 
> > wrote:
>
>> I am playing with clojurescript, and I have this code:
>>
>> (defn prepare [number]
>>   (def targets (take 4 (drop (* 4 (- number 1)) (dom/getElementsByClass 
>> "place-div"
>>   (def target-objects (map #(make-target %) targets))
>>   (for [drag draggables target target-objects]
>> (.addTarget drag target))
>>   (map #(.init %)  draggables)
>>   (map #(.init %) target-objects)
>>   draggables)
>>
>> It basically creates  a bunch of dragNdrop objects.
>> This code doesn't work in this method - no error, just doesn't do the job 
>> - 
>> but if I execute the lines one at a time from repl, it works fine.
>> Can someone please explain what the heck is going on ?
>>
>> much appreciated.
>>
>> -- 
>> 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
>
>
>
>
> -- 
> 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: clojurescript browser repl possible regression

2012-12-03 Thread Brent Millare
I've already tried both ways. Creating the html file with the script tag 
with the simple code you showed, and just simply trying to connect directly 
with http://localhost:9000/repl. In both cases, the same error message 
shows. Note that the error message isn't from my source code, but rather 
from the source code returned by http://localhost:9000/repl

On Monday, December 3, 2012 2:27:29 PM UTC-5, Herwig Hochleitner wrote:
>
> The browser repl works by creating a clojurescript file like:
>
> (ns foo (:require [clojure.browser.repl :as repl]))
>
> (repl/connect "http://localhost:9000/repl";)
>
> then compiling it (not in advanced mode) and using the output in a script 
> tag.
>
>
> 2012/12/3 Brent Millare >
>
>> Using clojurescript 3842d3f9e0d68853077117a919e93e169079
>>
>> Trying to do the simplest case of a clojurescript browser repl:
>>
>> running clojurescript/script/repl, then
>>
>> Taken straight from the documentation:
>>
>> (require '[cljs.repl :as repl])(require '[cljs.repl.browser :as browser])  
>> ;; require the browser implementation of IJavaScriptEnv(def env 
>> (browser/repl-env)) ;; create a new environment(repl/repl env) ;; start the 
>> REPL
>>
>> Next after trying to connect with browser at url 
>> http://localhost:9000/repl I get an error from google chrome's console.
>>
>> Uncaught ReferenceError: clojure is not defined
>>
>> 
>>  
>>  clojure.browser.repl.client.start("http://localhost:9000";);
>>  Uncaught ReferenceError: clojure is not defined
>> 
>>
>> Note that the rhino repl works fine.
>>
>> -- 
>> 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
>
>
>

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

clojurescript browser repl possible regression

2012-12-03 Thread Brent Millare
Using clojurescript 3842d3f9e0d68853077117a919e93e169079

Trying to do the simplest case of a clojurescript browser repl:

running clojurescript/script/repl, then

Taken straight from the documentation:

(require '[cljs.repl :as repl])(require '[cljs.repl.browser :as browser])  ;; 
require the browser implementation of IJavaScriptEnv(def env 
(browser/repl-env)) ;; create a new environment(repl/repl env) ;; start the REPL

Next after trying to connect with browser at url http://localhost:9000/repl 
I get an error from google chrome's console.

Uncaught ReferenceError: clojure is not defined



clojure.browser.repl.client.start("http://localhost:9000";);
Uncaught ReferenceError: clojure is not defined


Note that the rhino repl works fine.

-- 
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] vectorz-clj - high performance vector maths for Clojure

2012-12-03 Thread Michael Gardner
On Dec 2, 2012, at 06:24 , Mikera  wrote:

> Contributions / comments / suggestions very welcome. API is not yet set in 
> stone, so I'm very open to ideas on how to make it better.

Since the vast majority of physical applications will use 2D or 3D vectors, did 
you consider building around javax.vecmath? I have to imagine that would be 
faster than any generic vector implementation. I believe Zach Tellman's cantor 
(no longer maintained) used a similar approach.

-- 
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] vectorz-clj - high performance vector maths for Clojure

2012-12-03 Thread Herwig Hochleitner
I think this is a great addition to the ecosystem, thanks!

Right now I'm considering doing a small game, just to give it a try.


2012/12/2 Mikera 

> Sure - added instructions and uploaded version 0.0.1 to Clojars.
>
> Hopefully that works smoothly, any issues let me know.
>
> On Sunday, 2 December 2012 13:56:07 UTC, Michael Klishin wrote:
>>
>> 2012/12/2 Mikera 
>>
>> The Clojure library is here: 
>> https://github.com/**mikera/vectorz-clj
>>>
>>
>> Please add installation/dependency instructions to the README.
>>  --
>> 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
>

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

ANN Monger 1.4.0 is released

2012-12-03 Thread Michael Klishin
Monger (http://clojuremongodb.info) is an idiomatic Clojure MongoDB driver
for a more civilized age.
It has batteries included, offers powerful expressive query DSL, strives to
support every MongoDB 2.0+ feature and has sane defaults.
It also has solid documentation.

`1.4.0` is a minor *almost (but not completely) backwards-compatible*
release that upgrades MongoDB Java driver and
Cheshire and adapts to their public API changes.


## Changes in 1.4.0

### MongoDB Java Driver Update

MongoDB Java driver dependency has been updated to 2.10.0 [1][2]. If your
code depends on the exact
class `com.mongodb.Mongo`, it should be updated to use
`com.mongodb.MongoClient` (or not depend on specific class names at all).

In addition, `MongoOptions` and `MongoURI` in the new driver have changed
to `MongoClientOptions` and `MongoClientURI`, respectively.


### Cheshire 0.5.0

`monger.json` and `monger.joda-time` will use Cheshire [3] if it is
available and now
*requires Cheshire version 5.0*.
clojure.data.json is no longer a hard dependency (but `0.1.x` versions
still supported if available).

Recently released `clojure.data.json` version `0.2.0` is now supported. We
strongly recommend all users to use Cheshire when possible.

Cheshire 5.0 change log [4] is available on GitHub.


### ClojureWerkz Support 0.9.0

ClojureWerkz Support library is upgraded to `0.9`.


## Change Log

We recommend all users to upgrade to 1.4.0 [5] as soon as possible.

Monger change log is available on GitHub [6].


1.
https://groups.google.com/forum/?fromgroups=#!topic/mongodb-announce/FHp6ue36WUw
2. http://blog.mongodb.org/post/3163412/introducing-mongoclient
3. https://github.com/dakrone/cheshire
4. https://github.com/dakrone/cheshire/blob/master/ChangeLog.md
5. https://clojars.org/com.novemberain/monger/versions/1.4.0
6. https://github.com/michaelklishin/monger/blob/master/ChangeLog.md

-- 
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: small error on clojure.org/reader

2012-12-03 Thread Otto Allmendinger
Oops - you'd think I'd be able to match braces by now ;-)

I must admit that I don't know how to write this more clearly either 
without a large rewrite, so it probably is best to just leave it as it is. 

On Sunday, December 2, 2012 11:28:21 PM UTC+1, Andy Fingerhut wrote:
>
> The full sentence is this:
>
> Syntax-quote (`, note, the "backquote" character), Unquote (~) and 
> Unquote-splicing (~@)
>
> It looks like perhaps someone started writing this:
>
> Syntax-quote (`), Unquote (~) and Unquote-splicing (~@)
>
> and then added some more explanatory text inside the parentheses to 
> emphasize which quote character it is.  I'm not saying it is as good as it 
> can be now, but I'm not sure this would be much better, as someone is bound 
> to point out that the ` character is not in parentheses like all the others 
> are on that page:
>
> Syntax-quote ` (note, the "backquote" character), Unquote (~) and 
> Unquote-splicing (~@)
>
> Andy
>
>
> On Dec 2, 2012, at 12:49 PM, Otto Allmendinger wrote:
>
> (I couldn't figure out where to put this so I might as well just post it 
> here)
>
>
> The page says 
>
> > Syntax-quote (`
>
> where it should say
>
> > Syntax-quote `(
>
>
> Otto
>
>

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

group-by vs. reducers?

2012-12-03 Thread László Török
Hi,

As I was trying to wrap my head around the reducers library[1], I thought
implementing group-by would be a good exercise to gain some insight.

After spending a few hours with it, I'm still pretty much clueless, so hope
to find someone here to help me out:

So if I understood the reducer lingo introduced in [2],[3] and group-by
correctly, it reduces the following reducing function on a collection

(fn group-by-reducef [keyfn ret x]
 (let [k (keyfn x)]
(assoc ret k (conj (get ret k []) x

where keyfn is provided by a partial function application.

fold needs a combining function that takes two result maps that have
already been grouped and merges them.
A naive implementation could look like

(defn group-by-combinef
  ([] {})
  ([g1 g2]
 (persistent!
  (reduce (fn [res k v]
(assoc! res k (into (get res k []) v)))
  (transient g1) g2

(defn group-by [f coll]
  (fold (partial gr-by-reducef f) gr-by-combinef coll))

Now couple of questions:
1) I expected fold to actually perform the operation, how can I force it to
give me the result?
2) Can somehow the actual reducing at the leaf nodes still take advantage
of transient collections?
3) I took a look at flatten as it seems the "closest" match. Again, if I
call (flatten [[1 2] [2 4]]), I don't actually get the result. How do I get
to the result?


Thanks!

[1]
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj
[2]
http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
[3] http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html
-- 
László Török

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

Need sample producer/consumer code using clamq library (activemq)

2012-12-03 Thread shuaybi
Apologize if this is a duplicate email. 

Can someone send me sample code that uses clamq library to produce/consume 
messages over activemq.

The consumer should be in some kind of infinite loop - always checking for 
messages. I want to be able to run the code in two instances of the REPL. 
>From one REPL I should be able to send a message while the other one simply 
prints it  to the console.

Thanks for your help.

-- 
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: exception in 'map' mutates result to nil -- bug?

2012-12-03 Thread Hank
Ah thanks many times. I saw 457 when I searched the issue list before opening a 
new one but it wasn't clear to me they were related. I shall use your patch in 
my private fork.

On Tuesday, 4 December 2012 01:06:03 UTC+11, Christophe Grand  wrote:
> This behavior has the same source as CLJ-457. Applying my patch for CL-457, I 
> get:
> 
> user=>  (def mapped (map (fn [_] (throw (Exception.))) [1 2 3]))
> #'user/mapped
> user=> mapped
> 
> Exception   user/fn--1 (NO_SOURCE_FILE:1)
> (user=> mapped
> RuntimeException Recursive seq realization  clojure.lang.LazySeq.sval 
> (LazySeq.java:64)
> (user=> mapped
> RuntimeException Recursive seq realization  clojure.lang.LazySeq.sval 
> (LazySeq.java:64)
> 
> 
> 
> and
> 
> 
> 
> lazy: (#
> lazy, again: (# realization>
> 
> 
> 
> 
> for the other example.
> 
> 
> So the error message may be more generic.
> 
> 
> Christophe
> 
> 
> 
> On Mon, Dec 3, 2012 at 10:37 AM, Hank  wrote:
> 
> I opened a bug report, let's see what the pros have to say on this: 
> http://dev.clojure.org/jira/browse/CLJ-1119
> 
> 
> 
> 
> 
> 
> --
> 
> 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
> 
> 
> 
> 
> 
> -- 
> On Clojure http://clj-me.cgrand.net/
> Clojure Programming http://clojurebook.com
> 
> Training, Consulting & Contracting http://lambdanext.eu/

-- 
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: exception in 'map' mutates result to nil -- bug?

2012-12-03 Thread Christophe Grand
This behavior has the same source as CLJ-457. Applying my patch for CL-457,
I get:
user=>  (def mapped (map (fn [_] (throw (Exception.))) [1 2 3]))
#'user/mapped
user=> mapped
Exception   user/fn--1 (NO_SOURCE_FILE:1)
(user=> mapped
RuntimeException Recursive seq realization  clojure.lang.LazySeq.sval
(LazySeq.java:64)
(user=> mapped
RuntimeException Recursive seq realization  clojure.lang.LazySeq.sval
(LazySeq.java:64)

and

lazy: (#
lazy, again: (#

for the other example.

So the error message may be more generic.

Christophe


On Mon, Dec 3, 2012 at 10:37 AM, Hank  wrote:

> I opened a bug report, let's see what the pros have to say on this:
> http://dev.clojure.org/jira/browse/CLJ-1119
>
> --
> 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
>



-- 
On Clojure http://clj-me.cgrand.net/
Clojure Programming http://clojurebook.com
Training, Consulting & Contracting http://lambdanext.eu/

-- 
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: understanding 'binding' use in clojure.java.jdbc

2012-12-03 Thread Matthias Cords
Hi,

I found database connection pools to be the right thing to use with
c.j.jdbc and multiple databases.

https://clojars.org/org.bituf/clj-dbcp

(let [conn1 (make-pool-1)
  conn2 (make-pool-2)]
  (sql/with-connection conn1
(sql/with-query-results r ["select ..."]
  (sql/with-connection conn2
(sql/do-commands "insert into ...")

matt



On 10 October 2012 15:03, Stuart Sierra  wrote:

>
>
> On Tuesday, October 9, 2012 10:25:05 PM UTC-4, Sean Corfield wrote:
>>
>> This is why c.j.jdbc is getting an API overall that will expose functions
>> that accept the connection or the db-spec directly (and the old API will be
>> rewritten in terms of the new one for compatibility).
>
>
> Excellent.
> -S
>
>  --
> 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: (def some? (comp not nil? some))

2012-12-03 Thread Niels van Klaveren
That's why Jim mentions if-let and when-let in combination with some, they 
both detect if results are nil.

On Sunday, December 2, 2012 10:11:24 PM UTC+1, Ben wrote:
>
> On Sun, Dec 2, 2012 at 12:48 PM, Jim - FooBar(); 
> > 
> wrote: 
> > Its perfectly fine to use some as a predicate as far as I know...works 
> > excellent with if-let/when-let - what is the problem? 
>
> There might be cases in which it matters whether something returns nil 
> (as 'some' does) or false (as 'some?' would). ('keep', for instance, 
> unlike 'filter', discriminates between nil and false.) 
>
> -- 
> Ben Wolfson 
> "Human kind has used its intelligence to vary the flavour of drinks, 
> which may be sweet, aromatic, fermented or spirit-based. ... Family 
> and social life also offer numerous other occasions to consume drinks 
> for pleasure." [Larousse, "Drink" entry] 
>

-- 
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: exception in 'map' mutates result to nil -- bug?

2012-12-03 Thread Hank
I opened a bug report, let's see what the pros have to say on this: 
http://dev.clojure.org/jira/browse/CLJ-1119

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