Clojure pre assertion functions does not work with keyword?

2014-02-13 Thread Mamun
Hi

I am just testing clojure :pre condition. But look like using keyword?, it 
is not working in clojure 1.5.1. 

(defn check-keyword [v] {:pre [keyword? v]} v)

(defn check-nil [v] {:pre [nil? v]} v)

(check-keyword “sdf”) ;Not throwing exception here

(check-nil nil) ;Throwing exception



Br,

Mamun

-- 
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 pre assertion functions does not work with keyword?

2014-02-13 Thread Ambrose Bonnaire-Sergeant
Hi Mamun,

This is the correct syntax (you're missing some parens).

(defn check-keyword [v] {:pre [(keyword? v)]} v)

Thanks,
Ambrose


On Thu, Feb 13, 2014 at 6:47 PM, Mamun  wrote:

> Hi
>
> I am just testing clojure :pre condition. But look like using keyword?, it
> is not working in clojure 1.5.1.
>
> (defn check-keyword [v] {:pre [keyword? v]} v)
>
> (defn check-nil [v] {:pre [nil? v]} v)
>
> (check-keyword "sdf") ;Not throwing exception here
>
> (check-nil nil) ;Throwing exception
>
>
>
> Br,
>
> Mamun
>
>  --
> 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: Keyword equality check

2014-02-13 Thread Arkadiusz Komarzewski
Guys, thank you all for input.

I found that both keywords were (as you expected) loaded by same 
classloader (same parent was used in both). After fixing that the assert 
indeed fails.

Cheers!

On Thursday, 13 February 2014 00:41:12 UTC+1, Alex Miller wrote:
>
> Reading a little more closely, that's an identity comparison in Java, not 
> an equals comparison in Clojure (who uses Java anyways? :). So I would 
> retract my last statement. The question is really whether the two 
> classloaders are deferring the load of the common class to a parent 
> classloader that loads the same Keyword class. You can ask the Keyword 
> classes you have for their classloader and then look through the parents to 
> investigate that question.
>
>
>
> On Wednesday, February 12, 2014 5:32:07 PM UTC-6, Alex Miller wrote:
>>
>> I think it's a little more subtle than that.  Symbols are composed of a 
>> String name and a String namespace. When symbols are created they intern 
>> each of those Strings. Interned Strings are comparable by identity across 
>> the JVM. Symbol equals() compares name and namespace. Keyword extends from 
>> Symbol and calls into the Symbol interning and inherits the equals() 
>> implementation. 
>>
>> As Jozef mentions, the Keyword intern table is held in a static map in 
>> Keyword and that would not be shared if you had multiple Clojure 
>> classloaders. However, I think the Keyword intern table is largely to avoid 
>> creating multiple instances of the same Keyword (as well as safely cleaning 
>> them up if no one is using them anymore). This is all irrelevant for the 
>> equality comparison in the original post.
>>
>>
>> On Wednesday, February 12, 2014 10:45:38 AM UTC-6, Jozef Wagner wrote:
>>>
>>> Interning table uses keyword's symbol as a key, and the symbols are 
>>> compared by value. See 
>>> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Keyword.java#L37
>>>
>>>
>>> On Wed, Feb 12, 2014 at 5:23 PM, Arkadiusz Komarzewski <
>>> akomar...@gmail.com> wrote:
>>>
 Hi,

 I wonder how is equality of keywords implemented in Clojure?

 I have this piece of Java code executed in one classloader:
 Keyword a = (Keyword) RT.var("clojure.core", 
 "keyword").invoke("keyword");

 Then, when I pass it to another part of my application (which uses 
 another classloader) and do this:
 Keyword b = (Keyword) RT.var("clojure.core", 
 "keyword").invoke("keyword");
 assert a == b;

 Assertion passes.
 Why does it work? If I'm correct, keywords are interned, but since they 
 were created in separate classloaders shouldn't that assert fail?
  
 -- 
 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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@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.


CLJX & CLJS problem

2014-02-13 Thread Karsten Schmidt
I've been busy working on a few libraries targetting both Clojure &
ClojureScript, however so far have only tested the CLJ side and now that it
comes to addressing CLJS am running in circles (and on fumes)
unsuccessfully trying to tweak my project settings to make things work.

All my source is using CLJX stored in the the "src-cljx" folder. My rules
then trigger generated sources into "src-clj" (for all Clojure and shared
macros) and "src-cljs" for CLJS parts only.

My project.clj is as follows:

(defproject foo "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.5.1"]
 [org.clojure/clojurescript "0.0-2156"]]

  :jar-exclusions [#"\.cljx|\.DS_Store|\.js|\.html"]

  :cljx {:builds [{:source-paths ["src-cljx"]
   :output-path "src-clj"
   :rules :clj}
  {:source-paths ["src-cljx"]
   :output-path "src-cljs"
   :rules :cljs}]}

  :cljsbuild {:builds
  [{:id "dev"
:source-paths ["src-clj" "src-cljs"]
:compiler
{:pretty-print true
 :output-to "foo-0.1.0-SNAPSHOT.js"
 :optimizations :simple}
:jar true}]}

  :plugins [[com.keminglabs/cljx "0.3.2"]
[lein-cljsbuild "1.0.2"]]
  :hooks [cljx.hooks leiningen.cljsbuild])

I can successfully create a JAR from this with `lein install`, however if I
try to use this library as dependency in another CLJS project, none of the
namespaces of this dependency seem to be found, even though I verified that
they're present in the JAR (contains both .clj & .cljs versions).

So I then assumed the reasons for this are the non-standard names for the
source folders. But adding this line at the root level of project.clj will
not work either and makes `lein install` fail with a
"java.util.zip.ZipException: duplicate entry":

:source-paths ["src-clj" "src-cljs"]

Therefore can someone please explain or point me to a correct project setup
to make this work? I've been trying to find answers on SO & Google, but it
seems this (strangely?) isn't a popular use case and I couldn't find any
helpful answers.

Once this is solved am happy to write up a short tutorial or create a lein
template for future reference.

Thank you!
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
--- 
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 to invoke java method obtained using clojure.reflect

2014-02-13 Thread zcaudate
Try my new library. It makes reflection really easy to use
http://github.com/zcaudate/iroh

-- 
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 pre assertion functions does not work with keyword?

2014-02-13 Thread Mamun
HI Ambrose,

Thanks for your reply. But why this one is working?

 (defn check-nil [v]
 {:pre [nil? v]}
  v)

Br,
Mamun


On Thursday, February 13, 2014 11:51:31 AM UTC+1, Ambrose Bonnaire-Sergeant 
wrote:
>
> Hi Mamun,
>
> This is the correct syntax (you're missing some parens).
>
> (defn check-keyword [v] {:pre [(keyword? v)]} v)
>
> Thanks,
> Ambrose
>
>
> On Thu, Feb 13, 2014 at 6:47 PM, Mamun >wrote:
>
>> Hi
>>
>> I am just testing clojure :pre condition. But look like using keyword?, 
>> it is not working in clojure 1.5.1. 
>>  
>> (defn check-keyword [v] {:pre [keyword? v]} v)
>>
>> (defn check-nil [v] {:pre [nil? v]} v)
>>
>> (check-keyword “sdf”) ;Not throwing exception here
>>
>> (check-nil nil) ;Throwing exception
>>
>>
>>
>> Br,
>>
>> Mamun
>>
>>  -- 
>> 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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@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: Clojure pre assertion functions does not work with keyword?

2014-02-13 Thread Ambrose Bonnaire-Sergeant
It doesn't work, in your OP it incorrectly throws an exception when you
pass it nil.

:pre just takes a sequence of expressions which are executed like `do`, and
throws an exception if any expression returns a false value.

Thanks,
Ambrose


On Thu, Feb 13, 2014 at 7:53 PM, Mamun  wrote:

> HI Ambrose,
>
> Thanks for your reply. But why this one is working?
>
>
>  (defn check-nil [v]
>  {:pre [nil? v]}
>   v)
>
> Br,
> Mamun
>
>
>
> On Thursday, February 13, 2014 11:51:31 AM UTC+1, Ambrose
> Bonnaire-Sergeant wrote:
>
>> Hi Mamun,
>>
>> This is the correct syntax (you're missing some parens).
>>
>> (defn check-keyword [v] {:pre [(keyword? v)]} v)
>>
>> Thanks,
>> Ambrose
>>
>>
>> On Thu, Feb 13, 2014 at 6:47 PM, Mamun  wrote:
>>
>>> Hi
>>>
>>> I am just testing clojure :pre condition. But look like using keyword?,
>>> it is not working in clojure 1.5.1.
>>>
>>> (defn check-keyword [v] {:pre [keyword? v]} v)
>>>
>>> (defn check-nil [v] {:pre [nil? v]} v)
>>>
>>> (check-keyword "sdf") ;Not throwing exception here
>>>
>>> (check-nil nil) ;Throwing exception
>>>
>>>
>>>
>>> Br,
>>>
>>> Mamun
>>>
>>>  --
>>> 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 unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+u...@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.
>

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


clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Joachim De Beule
Dear list,

[Sorry if this may be a bit of topic, but I don't know much about php and 
http, and I'm not sure where else to turn]

I'm trying to port a working php api client implementation to clojure.

So on the one hand, I've got the following working php code for performing 
a signed post request:

function perform_request($url, $method, $key, $secret) {
$query_params['method'] = $method;
$mt = explode(' ', microtime());
$query_params['nonce'] = $mt[1]*1000;
$query_string = http_build_query($query_params, '', '&');
$sign = hash_hmac("sha512", $query_string, $secret);
$headers = array(
'sign: '.$sign,
'key: '.$key,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$res = curl_exec($ch);
return $res;
}


On the other hand, I've got the following clojure code which, as far as I 
can tell, performs an identical request (I've checked that the signatures 
are the same in both implementations):

(defn perform-request [url method key secret]
  (let [query-params {:method method
:nonce (clj-time.coerce/to-long 
(clj-time.core/now))}
 query-string (clj-http.client/generate-query-string query-params)
 signature (pandect.core/sha512-hmac query-string secret)]
(clj-http.client/post url
{:query-params query-params
 :headers {"sign" signature
  "key" key}})))

Unfortunately, the clojure code always returns with an "unable to authorize 
request, check post data" response from the remote service, and I don't 
understand why? Is it possible that the default client settings in php/curl 
are different from those in clj-http or something, i.e. maybe I need to 
disable/add some clj-http request wrappers or something? 

-- 
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: meta circular clojure

2014-02-13 Thread Di Xu
2014-02-13 1:05 GMT+08:00 Herwig Hochleitner :

> 2014-02-12 5:36 GMT+01:00 Di Xu :
>
>>
>>  all lisp dialect provide `read` function, so if you want to build an
>> evaluator, you could just use this function and don't need to do lexical
>> and syntax analysis.
>>
>
> Maybe your understanding of these terms is different from mine, in my
> view: A lisp evaluator needs to do syntactic and lexical analysis. Those
> are both performed after the data structures have been parsed by `read` and
> then macroexpanded by the compiler. Macroexpansion could be considered part
> of syntactic analysis for most macros.
>
>
Yeah, a little different indeed. I mean if you want to use `read` to read
user's input, you don't have to do `read`'s part of lexical and syntax
analysis (imagining your situation when you can only read a char in
stream), that include checking parentheses matching and symbol picking from
stream.

Yes, to implement your different version of lisp, you have to do some
lexical and syntax analysis, that's your job.

I didn't phrase myself correctly. Sorry for that.

-- 
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: clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Gijs S.
 

Untested of course, but I think you need to use either :body or 
:form-params rather than :query-params to put the query-params data into 
the body of the post request.

-- 
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: clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Kevin Ilchmann Jørgensen
They return identical data if you use http://httpbin.org/post as url ?

/Kevin


On Thu, Feb 13, 2014 at 1:35 PM, Gijs S.  wrote:

> Untested of course, but I think you need to use either :body or
> :form-params rather than :query-params to put the query-params data into
> the body of the post request.
>
> --
> 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: clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Joachim De Beule
That did the trick! Thanks!!

Op donderdag 13 februari 2014 13:35:46 UTC+1 schreef Gijs S.:
>
> Untested of course, but I think you need to use either :body or 
> :form-params rather than :query-params to put the query-params data into 
> the body of the post request.
>

-- 
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: clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Joachim De Beule
Solved by Gijs S., but thanks anyway, I didn't know about httpbin.org.

Op donderdag 13 februari 2014 14:03:18 UTC+1 schreef Kevin Ilchmann 
Jørgensen:
>
> They return identical data if you use http://httpbin.org/post as url ?
>
> /Kevin
>
>

-- 
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: OT: Enterprise Schedulers

2014-02-13 Thread icamts
Hi Adrian,
I've been discovered :) I enjoyed exploring a ESB scenario. In abstract you 
may go along the lines of any of ESB solutions this way:

1) Any task is performed by suitably configured components
2) componets live in a container
3) components communicate through a message router
4) special components resolve technology itegration issues (connectors)

Another interesting approach is provided by Akka. Have a look to this thread

https://groups.google.com/forum/#!topic/akka-user/KFzPbaNglPQ

A clojure library providing erlang like actors is pulsar

https://github.com/puniverse/pulsar

Cheers,
Luca



Il giorno mercoledì 12 febbraio 2014 13:37:28 UTC+1, Adrian Mowat ha 
scritto:
>
> Hi Luca
>
> Thanks for the links!
>
> I definitely have a lot of hammock time ahead of me :-)
>
> Cheers
>
> Adrian
>
>
> On 11 Feb 2014, at 14:37, icamts wrote:
>
> Hi Adrian,
> the answer is more off-topic than the question :) but have a look to 
> Spagic (I'm a member of the developers' team), Mule ESB, Petals ESB or 
> Talend ESB. You may already know Talend as an ETL solution. You'll find 
> tools to define, configure and run instances of services or processes. 
> Monitong application with re-start / re-run facilities. Connectors for 
> services / processes integration.
>
> In a ESB scenario developers will design simple processes with a quartz or 
> file polling connector followed by a script / custom component designed to 
> accomplist the batch task. 
>
> Custom components can be written in clojure if you reify the required 
> interface. The only cavevat is the AOT compilation.
>
> Some other ideas are below, along your problem statement.
>
> Cheers,
> Luca
>
>
>>- Be controlled by artifacts developers control
>>   - Probably be github friendly
>>
>>  
> Put service deployment directory and estensions / plugins directory under 
> version control and copy them as a part of the deployment process. An ESB 
> can be deployed like a simple webapp.
>
>>
>>- 
>>   - Provide a direct relationship between an application and its 
>>   tasks
>>
>>
> Choose meaningful service names. Deploy a local ESB in the same AS of your 
> application and use an in-memory invoker / connector. 
>
>>
>>- Support separate sandbox, staging and production environments
>>
>>
>  Use different ESB instances.
>
>>
>>- Be scalable
>>
>>
> Single task scalability is up to your code.
>
>>
>>- Be distributed - jobs for application X can run on the same host as 
>>application X or on a different host or cluster as needed
>>
>>
> Sevices / processes can be run on every ESB instance. Use in-memory 
> invoker / connector or soap invoker / connector.
>
>>
>>- Be secure
>>
>>
> Use https for remote connection. Use sftp for file transfer. 
>
>>
>>- Be easy to administer
>>   - Job progress and status is visible
>>
>>
> Service progress notification is up to your code and not a monitor console 
> feature. Process running step is available. 
>
>>
>>- 
>>   - Alert when a job fails
>>
>>
> Use a mail connector to alert on job fails
>
>>
>>- 
>>   - Easy to re-run a job
>>
>>
> Restart / rerun through monitoring console. 
>
>>
>>- 
>>   - Easy to spin up new hosts and/or move all processing to a 
>>   different host
>>
>>
> Deploy a new instance with the same configuration. No running service can 
> be moved. Running processes may be moved. It depends on workflow engine 
> implementation details.
>
>>
>>- 
>>   - Provide a standard way of organising assets like files and 
>>   configs across all our applications
>>
>>  
> (Not sure what you mean.)
>
>>
>>- Comply with our hybrid infrastructure (stuff runs internally and in 
>>the cloud)
>>   - Data can move internal -> cloud
>>
>>  
> Is it an ETL task?
>
>>
>>- 
>>   - Data can move cloud -> internal
>>
>>
> Same as before 
>
>>
>>- 
>>   - Data can be processed entirely within a host
>>
>>  
> That's so
>
>>
>>- Support different ways of triggering a job
>>   - Scheduled tasks
>>
>>
> Use a quartz input connector 
>
>>
>>- 
>>   - Run when file x arrives
>>
>>
> Use a file poller input connector 
>
>>
>>- 
>>   - Run job y after job x completes
>>
>>  
> Use an output connector to trigger the next job start or design a process 
> with jobs in a sequence.
>
> -- 
> 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 a topic in the 
> Google Groups "Clojure" group.
> To unsubscribe from this topic, vi

[GSoC]: Need help? Add your project to the ideas page. (deadline tomorrow)

2014-02-13 Thread Daniel Solano Gómez
Hello, all,

Would you like help in growing your Clojure project?  Please add it to
the Project Ideas page [1] and help Clojure get accepted into the Google Summer
of Code.

Clojure has benefited from its involvement in GSoC in past years.  It
has helped projects like Typed Clojure, Clojure in Clojure, and Clojure
on Android, and it could help yours too.

Please add project ideas soon, as the application deadline is in just
over 24 hours.

Thanks for your help.

Sincerely,

Daniel

[1]: http://dev.clojure.org/display/community/Project+Ideas

-- 
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: range-sum

2014-02-13 Thread Stuart Sierra
> In the olden lisp days, reduce was often preferred to
> apply because apply could hit limits on the number of
> arguments that could be passed to a function. Is that a
> potential issue with clojure?

No. Clojure's `apply` is lazy. Varargs are passed to the
function as a lazy sequence, and it's up to the function to
realize them or not.

For example, this is perfectly valid:

(defn foo [x y z & args]
  ;; args is never used
  z)

(apply foo (range))  ; call with infinite sequence
;;=> 2

-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 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: range-sum

2014-02-13 Thread Michał Marczyk
str is much faster with apply than with reduce; in fact, with reduce
it is O(n^2), whereas with apply it is O(n). (The constants are better
with apply too.)

In general, (apply foo ...) takes advantage of any optimizations the
author of foo might be aware of for speeding up its operation when
given multiple arguments. (reduce foo ...) is always a simple-minded
fold. Not that that's never useful; it is with reducers and with
anonymous functions.


On 12 February 2014 21:06, Vincent  wrote:
> On Wednesday, February 12, 2014 2:47:07 PM UTC, Stuart Sierra wrote:
>>
>> On Wednesday, February 12, 2014 8:46:41 AM UTC-5, Vincent wrote:
>>>
>>> On a slightly different topic: why reduce and not apply?
>>
>>
>> The implementation of `+` with more than 2 arguments uses `reduce`
>> internally. So they amount to the same thing.
>
>
> Ah ok, interesting. I do seem to have, in the past, come across a function
> that was significantly faster when used with apply rather than reduce, but I
> can't remember which one.
>
>
>>
>> There isn't really a performance difference:
>>
>> user=> (dotimes [i 7] (time (reduce + (range 1000
>> "Elapsed time: 354.475 msecs"
>> "Elapsed time: 346.235 msecs"
>> "Elapsed time: 348.124 msecs"
>> "Elapsed time: 348.894 msecs"
>> "Elapsed time: 379.9 msecs"
>> "Elapsed time: 356.337 msecs"
>> "Elapsed time: 362.788 msecs"
>> nil
>> user=> (dotimes [i 7] (time (apply + (range 1000
>> "Elapsed time: 360.067 msecs"
>> "Elapsed time: 353.281 msecs"
>> "Elapsed time: 345.694 msecs"
>> "Elapsed time: 355.162 msecs"
>> "Elapsed time: 346.511 msecs"
>> "Elapsed time: 350.61 msecs"
>> "Elapsed time: 353.674 msecs"
>> nil
>
>
> Thanks,
> Vincent
>
> --
> 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.


why my java code (call clojure from java ) run spend so much loooooog time .

2014-02-13 Thread Xiaojun Weng
I am a new clojure player,but i have wrote java code by few years.

when i use emacs run my clojure code (read a big file  50M  ) , nrepl run 
over use 30 second.
but i use lein uberjar  clojure to jar .and i use it jar in eclipse , this 
jar import in a embeded jetty when it started,   
some time it would  outofmemory  or wait looog time. more than 30 minutes.

some one tell me why. please. 

-- 
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 my java code (call clojure from java ) run spend so much loooooog time .

2014-02-13 Thread Dennis Haupt
give your vm more memory


2014-02-13 17:02 GMT+01:00 Xiaojun Weng :

> I am a new clojure player,but i have wrote java code by few years.
>
> when i use emacs run my clojure code (read a big file  50M  ) , nrepl run
> over use 30 second.
> but i use lein uberjar  clojure to jar .and i use it jar in eclipse , this
> jar import in a embeded jetty when it started,
> some time it would  outofmemory  or wait looog time. more than 30 minutes.
>
> some one tell me why. please.
>
> --
> 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.


pretty-exception middleware for ring

2014-02-13 Thread bob
Hey,

a simple exception middle-ware for ring, maybe useful for some,maybe none. 
it catch exceptions and print, meanwhile the source code produced the 
exception will be print as well.

- The demo will stay here (click me)
 . 
- The source code is 
here
 .

-- 
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: pretty-exception middleware for ring

2014-02-13 Thread Herwig Hochleitner
Looks great. I've incorporated this into my debug configuration.


2014-02-13 17:39 GMT+01:00 bob :

> Hey,
>
> a simple exception middle-ware for ring, maybe useful for some,maybe none.
> it catch exceptions and print, meanwhile the source code produced the
> exception will be print as well.
>
> - The demo will stay here (click me)
>  .
> - The source code is 
> here
>  .
>
> --
> 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: range-sum

2014-02-13 Thread Jozef Wagner
I would say that with good reducers, the reduce approach can eliminate seq
creation and thus be at least a bit faster and less demanding for GC.


On Thu, Feb 13, 2014 at 4:16 PM, Michał Marczyk wrote:

> str is much faster with apply than with reduce; in fact, with reduce
> it is O(n^2), whereas with apply it is O(n). (The constants are better
> with apply too.)
>
> In general, (apply foo ...) takes advantage of any optimizations the
> author of foo might be aware of for speeding up its operation when
> given multiple arguments. (reduce foo ...) is always a simple-minded
> fold. Not that that's never useful; it is with reducers and with
> anonymous functions.
>
>
> On 12 February 2014 21:06, Vincent  wrote:
> > On Wednesday, February 12, 2014 2:47:07 PM UTC, Stuart Sierra wrote:
> >>
> >> On Wednesday, February 12, 2014 8:46:41 AM UTC-5, Vincent wrote:
> >>>
> >>> On a slightly different topic: why reduce and not apply?
> >>
> >>
> >> The implementation of `+` with more than 2 arguments uses `reduce`
> >> internally. So they amount to the same thing.
> >
> >
> > Ah ok, interesting. I do seem to have, in the past, come across a
> function
> > that was significantly faster when used with apply rather than reduce,
> but I
> > can't remember which one.
> >
> >
> >>
> >> There isn't really a performance difference:
> >>
> >> user=> (dotimes [i 7] (time (reduce + (range 1000
> >> "Elapsed time: 354.475 msecs"
> >> "Elapsed time: 346.235 msecs"
> >> "Elapsed time: 348.124 msecs"
> >> "Elapsed time: 348.894 msecs"
> >> "Elapsed time: 379.9 msecs"
> >> "Elapsed time: 356.337 msecs"
> >> "Elapsed time: 362.788 msecs"
> >> nil
> >> user=> (dotimes [i 7] (time (apply + (range 1000
> >> "Elapsed time: 360.067 msecs"
> >> "Elapsed time: 353.281 msecs"
> >> "Elapsed time: 345.694 msecs"
> >> "Elapsed time: 355.162 msecs"
> >> "Elapsed time: 346.511 msecs"
> >> "Elapsed time: 350.61 msecs"
> >> "Elapsed time: 353.674 msecs"
> >> nil
> >
> >
> > Thanks,
> > Vincent
> >
> > --
> > 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.
>

-- 
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: GSoC 2014: org applications now open

2014-02-13 Thread A

I think this is a great discussion, and there are myriad ways to get there. 
I haven't settled my own opinions firmly enough to advocate for one 
implementation over another at this point, but I do think that Incanter 
could become a killer toolbox (even more than now) with the additon of...:


1. a literate programming "Notebook" solution - inspiring repeatable 
analysis, to communicate or publish methods and results).  Perhaps RStudio 
(http://www.rstudio.com/ide/), Light Table, and Emacs should be metaphors 
for the shape this could take.  A stretch goal might be something like 
Mathematica if this is even possible.

2. a Clojurescript visualization layer to make use of the amazing 
visualization currently in the javascript world.

Perhaps these two things can effectively unify and become one via Light 
Table or Browser repl.


A last idea is the integration of Incanter analysis with Pallet 
(https://github.com/pallet/pallet , http://palletops.com/) to spawn compute 
servers as necessary (perhaps GPU, perhaps cascalog/hadoop, or vowpal 
wabbit / hadoop, etc.. )



Best regards,
Avram





On Tuesday, February 11, 2014 4:44:54 PM UTC-8, Mikera wrote:
>
> On the idea of a workbench / clojurescript integration, I always liked the 
> idea of a Light Table based analytical workbench that could connect to a 
> Clojure-based Incanter server (which might of course be running all the 
> heavy computations on a core.matrix GPU backend..)
>
> I don't know enough ClojureScript to be able to mentor such a project, but 
> happy to add it as an idea. should be feasible for a smart GSoC student 
>
> On Saturday, 8 February 2014 07:02:52 UTC+8, A wrote:
>>
>>
>> A couple ideas put forth:
>>
>> 1. Incanter charts with d3 (http://d3js.org/) ?  Perhaps facilitated by 
>> Dribnet's Strokes library (https://github.com/dribnet/strokes).
>>
>> 2. Finding ways to integrate Incanter and Clojurescript.
>>
>> Thoughts?
>>
>> -Avram
>>
>>
>>
>>
>> On Monday, February 3, 2014 11:59:24 AM UTC-8, Daniel Solano Gómez wrote:
>>>
>>> Hello, all, 
>>>
>>> Apparently, it's already time for organisations to apply for Google 
>>> Summer of Coder 2014 [1].   This is a great program, and there have been 
>>> several notable projects that have benefited as a result.  For example, 
>>> last year's successful projects included: 
>>>
>>> * Enhance Neko for Android, Alexander Yakushev 
>>> * core.typed: Extensions and Documentation, Ambrose Bonnaire-Sergeant 
>>> * Clojure Compiler port to Clojure (CinC), Bronsa 
>>> * Implementation of core.matrix-compatible multidimensional array in 
>>> Clojure, Dmitry Groshev 
>>> * Algebraic Expressions, Maik Schünemann 
>>> * ClojureScript optimization and source maps support, Michal Marczyk 
>>>
>>> I would love to see Clojure participate again this year.  In order to do 
>>> so, we need to start our application which is due in less than two weeks. 
>>>  We need volunteers to help prepare our application, and in particular it 
>>> would be great to have administrators that can help lead the process.  I am 
>>> certainly willing to help out, but if there is someone who wants to lead up 
>>> this effort, I would happy to assist. 
>>>
>>> Ideally, we could have multiple administrators to spread out the 
>>> following duties: 
>>>
>>> * Updating the community wiki for the year [2] 
>>> * Recruiting potential mentors 
>>> * Raising the profile of GSoC within the community 
>>>
>>> If we are accepted as a GSoC organisation, administrator duties include: 
>>>
>>> * Ensuring we meet the deadlines 
>>> * Arranging for travel to the mentor submit 
>>> * Arranging for students' travel to conferences 
>>> * If necessary, solve problems 
>>>
>>> I am afraid that last year I let the ball drop a bit with the mentor 
>>> summit and getting students to conferences.  With multiple administrators 
>>> to help spread the work around, I am sure we can make GSoC an even better 
>>> experience for everyone involved. 
>>>
>>> If you are interested in helping out in this effort, please set up a 
>>> profile on Melange [3] and e-mail me your profile name.   
>>>
>>> Thanks for your help. 
>>>
>>> Sincerely, 
>>>
>>> Daniel 
>>>
>>>
>>> [1]: 
>>> http://google-opensource.blogspot.com/2014/02/mentoring-organization-applications-now.html
>>>  
>>> [2]: http://dev.clojure.org/display/community/Google+Summer+of+Code+2013 
>>> [3]: http://en.flossmanuals.net/melange/ 
>>>
>>

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

Re: Monkey-patching in Clojure

2014-02-13 Thread juan.facorro
You can also use the intern function to chamge the value of a any var in any 
namespace.

Hope it helps

-- 
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: range-sum

2014-02-13 Thread Michael Gardner
On Feb 13, 2014, at 08:56 , Stuart Sierra  wrote:

> No. Clojure's `apply` is lazy. Varargs are passed to the
> function as a lazy sequence, and it's up to the function to
> realize them or not.

It's worth noting (for people who might try to rely on that laziness) that 
apply will always realize its first four arguments. See 
http://clojurian.blogspot.com/2012/11/beware-of-mapcat.html

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
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: GSoC 2014: org applications now open

2014-02-13 Thread kovas boguta
On Thu, Feb 13, 2014 at 1:31 PM, A  wrote:

> 1. a literate programming "Notebook" solution - inspiring repeatable
> analysis, to communicate or publish methods and results).  Perhaps RStudio
> (http://www.rstudio.com/ide/), Light Table, and Emacs should be metaphors
> for the shape this could take.  A stretch goal might be something like
> Mathematica if this is even possible.

I'm glad people are enthused about this line of thinking, but I
question its viability as a summer project for a college student. This
isn't the kind of design work you want to get wrong.

-- 
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: GSoC 2014: org applications now open

2014-02-13 Thread Jony Hudson
Hi,

 I'm a bit late to the party here (and very new to the party - this being 
my first post to the group) but maybe this of interest:

 I've been working on number 1 and sort of number 2 since the start of the 
year, and have something pretty solid working now. It's a browser based 
REPL, in the notebook style with nice javascript-based visualisation. In 
fact, I said it better in the README that I was writing this morning:

"You can think of it like a pretty REPL that can plot graphs, or you can 
think of it as an editor for rich documents that
can contain interactive Clojure code, graphs, table, notes, LaTeX formulae. 
Whatever works for you! One of the main
aims is to make it lightweight enough that you can use it day-to-day 
instead of the command-line REPL, but also offer
the power to perform and document complex data analysis and modelling 
tasks. Above all else, Gorilla tries not to
dictate your workflow, but rather to fit in to the way you like to work, 
hopefully putting a bit more power to your
elbow."

It's got some features that I think are pretty neat: visualisations as 
values, notebook files are also plain clojure files, very lightweight 
interface (it's no iPython!). I was planning to get an initial release out 
next week or the week after. (BTW, I should note that the client side is 
written in javascript, not clojurescript - as it evolved from an earlier 
javascript project). Screenshot of extremely hastily put together example, 
attached! I haven't done much in the way of Incanter integration, but it's 
planned (and should work really well I think).

I appreciate it's hard to judge, given that you haven't seen anything of it 
yet, but I'd be very happy if it was interest for the submission. And I'm 
in the position and hopefully have the skills to help mentor someone (being 
an academic) if that's of use. And I'd be really very happy to do it.

Anyway, like I say, I appreciate that I'm unknown here, and talking about a 
project that no-one has seen yet, at the last minute (!) but it seemed like 
it would be silly not to mention what I'm up to :-) I'm happy to write up a 
few words for the wiki in the format above if anyone thinks it's a good 
idea.

Yours,


Jony


 

On Thursday, 13 February 2014 18:31:18 UTC, A wrote:
>
>
> I think this is a great discussion, and there are myriad ways to get 
> there. I haven't settled my own opinions firmly enough to advocate for one 
> implementation over another at this point, but I do think that Incanter 
> could become a killer toolbox (even more than now) with the additon of...:
>
>
> 1. a literate programming "Notebook" solution - inspiring repeatable 
> analysis, to communicate or publish methods and results).  Perhaps RStudio (
> http://www.rstudio.com/ide/), Light Table, and Emacs should be metaphors 
> for the shape this could take.  A stretch goal might be something like 
> Mathematica if this is even possible.
>
> 2. a Clojurescript visualization layer to make use of the amazing 
> visualization currently in the javascript world.
>
> Perhaps these two things can effectively unify and become one via Light 
> Table or Browser repl.
>
>
> A last idea is the integration of Incanter analysis with Pallet (
> https://github.com/pallet/pallet , http://palletops.com/) to spawn 
> compute servers as necessary (perhaps GPU, perhaps cascalog/hadoop, or 
> vowpal wabbit / hadoop, etc.. )
>
>
>
> Best regards,
> Avram
>
>
>
>
>
> On Tuesday, February 11, 2014 4:44:54 PM UTC-8, Mikera wrote:
>>
>> On the idea of a workbench / clojurescript integration, I always liked 
>> the idea of a Light Table based analytical workbench that could connect to 
>> a Clojure-based Incanter server (which might of course be running all the 
>> heavy computations on a core.matrix GPU backend..)
>>
>> I don't know enough ClojureScript to be able to mentor such a project, 
>> but happy to add it as an idea. should be feasible for a smart GSoC 
>> student 
>>
>> On Saturday, 8 February 2014 07:02:52 UTC+8, A wrote:
>>>
>>>
>>> A couple ideas put forth:
>>>
>>> 1. Incanter charts with d3 (http://d3js.org/) ?  Perhaps facilitated by 
>>> Dribnet's Strokes library (https://github.com/dribnet/strokes).
>>>
>>> 2. Finding ways to integrate Incanter and Clojurescript.
>>>
>>> Thoughts?
>>>
>>> -Avram
>>>
>>>
>>>
>>>
>>> On Monday, February 3, 2014 11:59:24 AM UTC-8, Daniel Solano Gómez wrote:

 Hello, all, 

 Apparently, it's already time for organisations to apply for Google 
 Summer of Coder 2014 [1].   This is a great program, and there have been 
 several notable projects that have benefited as a result.  For example, 
 last year's successful projects included: 

 * Enhance Neko for Android, Alexander Yakushev 
 * core.typed: Extensions and Documentation, Ambrose Bonnaire-Sergeant 
 * Clojure Compil

Re: range-sum

2014-02-13 Thread Michael Gardner
On Feb 13, 2014, at 14:31 , Michael Gardner  wrote:

> On Feb 13, 2014, at 08:56 , Stuart Sierra  wrote:
> 
>> No. Clojure's `apply` is lazy. Varargs are passed to the
>> function as a lazy sequence, and it's up to the function to
>> realize them or not.
> 
> It's worth noting (for people who might try to rely on that laziness) that 
> apply will always realize its first four arguments. See 
> http://clojurian.blogspot.com/2012/11/beware-of-mapcat.html

On further examination, I don't think this is correct.

user=> (defn f [x] (println x) x)
#'user/f
user=> (defn s [n] (lazy-seq (cons (f n) (s (inc n)
#'user/s
user=> (defn myfn [& args] nil)
#'user/myfn
user=> (apply myfn (s 0))
0
1
nil

I can't explain why exactly two of the elements in (s 0) are being realized 
here, but in any case my claim seems to be wrong.

-- 
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: range-sum

2014-02-13 Thread Mauricio Aldazosa
My guess is that when using a rest-param a call to next is involved thus
realizing two elements of the sequence. A call to rest only realizes the
first element:

user> (defn f [x] (println x) x)
#'user/f
user> (defn s [n] (lazy-seq (cons (f n) (s (inc n)
#'user/s
user> (def t (rest (s 0)))
0
#'user/t
user> (def u (next (s 0)))
0
1
#'user/u

-- 
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 my java code (call clojure from java ) run spend so much loooooog time .

2014-02-13 Thread Andy-
FYI:

http://stackoverflow.com/questions/21759848/

On Thursday, February 13, 2014 11:02:07 AM UTC-5, Xiaojun Weng wrote:
>
> I am a new clojure player,but i have wrote java code by few years.
>
> when i use emacs run my clojure code (read a big file  50M  ) , nrepl run 
> over use 30 second.
> but i use lein uberjar  clojure to jar .and i use it jar in eclipse , this 
> jar import in a embeded jetty when it started,   
> some time it would  outofmemory  or wait looog time. more than 30 minutes.
>
> some one tell me why. please. 
>

-- 
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] iroh 0.1.5 - Simple Java Reflection (Still SNAPSHOT but comments would be welcome)

2014-02-13 Thread zcaudate
Okay, 

v0.1.5 is out: http://z.caudate.me/jvm-class-reflection-made-simple/

-- 
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] iroh 0.1.5 - Simple Java Reflection (Still SNAPSHOT but comments would be welcome)

2014-02-13 Thread kovas boguta
On Wed, Feb 12, 2014 at 10:55 PM, zcaudate  wrote:

>
> Iroh is a library for jvm reflection. It is designed to be used for testing,
> repl based development, and blantant hacks bypassing the jvm security

This is pretty cool. Will give it a shot next time I'm trying to tame
a java lib.

-- 
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 code for detecting overlap of 3d shapes (specifically tetrahedra)?

2014-02-13 Thread Lee Spector

Can anyone point to Clojure code for detecting when two 3d shapes overlap, when 
given the [x y z] vertices of the two shapes?

The specific case I care about will always involve two regular tetrahedra (each 
of which is specified by 4 vertices), which may allow for special 
simplifications or efficiencies, but I'd be happy to have a more general 
solution as long as it's not weirdly slow.

I know that there are some sophisticated algorithms for doing this sort of 
thing (e.g. [1]), but the the algorithms I've found aren't trivial and the only 
source code I've found is pretty messy and would take some work to translate 
(e.g. from C). 

And I figure that if anybody is doing 3d stuff in Clojure then the code for 
this is probably floating around somewhere... but I haven't been able to find 
it.

Does anyone know of (or want to write :-) code for this?

I guess that a Java solution would also be workable, if I the interop is 
straightforward enough, but it'd be nicer to have a working algorithm in 
Clojure.

Thanks,

 -Lee

[1] Fast tetrahedron-tetrahedron overlap algorithm. F. Ganovelli, F. Ponchio 
and C. Rocchini August 11, 2002. 
http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=862BA3F999652E3B0BC1E7A6A3E04D49?doi=10.1.1.114.2540&rep=rep1&type=pdf



-- 
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: range-sum

2014-02-13 Thread Michael Gardner
On Feb 13, 2014, at 15:17 , Mauricio Aldazosa 
 wrote:

> My guess is that when using a rest-param a call to next is involved thus 
> realizing two elements of the sequence.

A destructured vararg is nil when there are no more items, which indeed 
requires realizing at least the first item. But that only explains why the 
first item gets realized, not the second (unless I'm missing something).

-- 
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: GSoC 2014: org applications now open

2014-02-13 Thread Christopher Small
@Jony

This is very exciting. Is this on github or somewhere else public? Would 
love to take a look at what you are doing. The snapshot looks awesome :-)

Chris


On Thursday, February 13, 2014 12:15:11 PM UTC-8, Jony Hudson wrote:
>
> Hi,
>
>  I'm a bit late to the party here (and very new to the party - this being 
> my first post to the group) but maybe this of interest:
>
>  I've been working on number 1 and sort of number 2 since the start of the 
> year, and have something pretty solid working now. It's a browser based 
> REPL, in the notebook style with nice javascript-based visualisation. In 
> fact, I said it better in the README that I was writing this morning:
>
> "You can think of it like a pretty REPL that can plot graphs, or you can 
> think of it as an editor for rich documents that
> can contain interactive Clojure code, graphs, table, notes, LaTeX 
> formulae. Whatever works for you! One of the main
> aims is to make it lightweight enough that you can use it day-to-day 
> instead of the command-line REPL, but also offer
> the power to perform and document complex data analysis and modelling 
> tasks. Above all else, Gorilla tries not to
> dictate your workflow, but rather to fit in to the way you like to work, 
> hopefully putting a bit more power to your
> elbow."
>
> It's got some features that I think are pretty neat: visualisations as 
> values, notebook files are also plain clojure files, very lightweight 
> interface (it's no iPython!). I was planning to get an initial release out 
> next week or the week after. (BTW, I should note that the client side is 
> written in javascript, not clojurescript - as it evolved from an earlier 
> javascript project). Screenshot of extremely hastily put together example, 
> attached! I haven't done much in the way of Incanter integration, but it's 
> planned (and should work really well I think).
>
> I appreciate it's hard to judge, given that you haven't seen anything of 
> it yet, but I'd be very happy if it was interest for the submission. And 
> I'm in the position and hopefully have the skills to help mentor someone 
> (being an academic) if that's of use. And I'd be really very happy to do it.
>
> Anyway, like I say, I appreciate that I'm unknown here, and talking about 
> a project that no-one has seen yet, at the last minute (!) but it seemed 
> like it would be silly not to mention what I'm up to :-) I'm happy to write 
> up a few words for the wiki in the format above if anyone thinks it's a 
> good idea.
>
> Yours,
>
>
> Jony
>
>
> 
>  
>
> On Thursday, 13 February 2014 18:31:18 UTC, A wrote:
>>
>>
>> I think this is a great discussion, and there are myriad ways to get 
>> there. I haven't settled my own opinions firmly enough to advocate for one 
>> implementation over another at this point, but I do think that Incanter 
>> could become a killer toolbox (even more than now) with the additon of...:
>>
>>
>> 1. a literate programming "Notebook" solution - inspiring repeatable 
>> analysis, to communicate or publish methods and results).  Perhaps RStudio (
>> http://www.rstudio.com/ide/), Light Table, and Emacs should be metaphors 
>> for the shape this could take.  A stretch goal might be something like 
>> Mathematica if this is even possible.
>>
>> 2. a Clojurescript visualization layer to make use of the amazing 
>> visualization currently in the javascript world.
>>
>> Perhaps these two things can effectively unify and become one via Light 
>> Table or Browser repl.
>>
>>
>> A last idea is the integration of Incanter analysis with Pallet (
>> https://github.com/pallet/pallet , http://palletops.com/) to spawn 
>> compute servers as necessary (perhaps GPU, perhaps cascalog/hadoop, or 
>> vowpal wabbit / hadoop, etc.. )
>>
>>
>>
>> Best regards,
>> Avram
>>
>>
>>
>>
>>
>> On Tuesday, February 11, 2014 4:44:54 PM UTC-8, Mikera wrote:
>>>
>>> On the idea of a workbench / clojurescript integration, I always liked 
>>> the idea of a Light Table based analytical workbench that could connect to 
>>> a Clojure-based Incanter server (which might of course be running all the 
>>> heavy computations on a core.matrix GPU backend..)
>>>
>>> I don't know enough ClojureScript to be able to mentor such a project, 
>>> but happy to add it as an idea. should be feasible for a smart GSoC 
>>> student 
>>>
>>> On Saturday, 8 February 2014 07:02:52 UTC+8, A wrote:


 A couple ideas put forth:

 1. Incanter charts with d3 (http://d3js.org/) ?  Perhaps facilitated 
 by Dribnet's Strokes library (https://github.com/dribnet/strokes).

 2. Finding ways to integrate Incanter and Clojurescript.

 Thoughts?

 -Avram




 On Monday, February 3, 2014 11:59:24 AM UTC-8, Daniel Solano Gómez 
 wrote:
>
> Hello, all, 
>
> Apparently, it's already ti

query on clojure maps / vectors

2014-02-13 Thread t x
Hi,

Preemptive: :-)

  * I'm not looking for datomic.
  * I'm also not looking for sqlkorma.

  * An "in-memory" data-log might be what I'm after.

Context:

  I'm reading:
http://code.kx.com/wiki/JB:QforMortals2/tables

  and it struck me -- why can't I view a clojure {vector,list} of maps
as a table? I.e.:

  [{:tag :animal :type :dog :age 2}
  {:tag :animal :type :cat :age 4}]

  then do queries on things like:

"get me all vector-indices of cats' of age >= 3"

Question:

  Is there a library (or even a blog post) about doing sql-like
querying on _in memory clojure data structures_ ?

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: CLJX & CLJS problem

2014-02-13 Thread Kevin Lynagh
It sounds like you have everything setup correctly---nothing stands out to 
me as being a problem.
I can't tell for sure without the project source code, though.

Take a look at Prismatic Schema's project.clj:

https://github.com/Prismatic/schema/blob/master/project.clj

they have the same use case as you do (using cljx in a clj and cljs 
library), so perhaps you can glean a magic config option from their 
project.clj.

best,

Kevin

On Thursday, February 13, 2014 3:22:25 AM UTC-8, Karsten Schmidt wrote:
>
> I've been busy working on a few libraries targetting both Clojure & 
> ClojureScript, however so far have only tested the CLJ side and now that it 
> comes to addressing CLJS am running in circles (and on fumes) 
> unsuccessfully trying to tweak my project settings to make things work.
>
> All my source is using CLJX stored in the the "src-cljx" folder. My rules 
> then trigger generated sources into "src-clj" (for all Clojure and shared 
> macros) and "src-cljs" for CLJS parts only.
>
> My project.clj is as follows:
>
> (defproject foo "0.1.0-SNAPSHOT"
>   :dependencies [[org.clojure/clojure "1.5.1"]
>  [org.clojure/clojurescript "0.0-2156"]]
>   
>   :jar-exclusions [#"\.cljx|\.DS_Store|\.js|\.html"]
>
>   :cljx {:builds [{:source-paths ["src-cljx"]
>:output-path "src-clj"
>:rules :clj}
>   {:source-paths ["src-cljx"]
>:output-path "src-cljs"
>:rules :cljs}]}
>
>   :cljsbuild {:builds
>   [{:id "dev"
> :source-paths ["src-clj" "src-cljs"]
> :compiler
> {:pretty-print true
>  :output-to "foo-0.1.0-SNAPSHOT.js"
>  :optimizations :simple}
> :jar true}]}
>
>   :plugins [[com.keminglabs/cljx "0.3.2"]
> [lein-cljsbuild "1.0.2"]]
>   :hooks [cljx.hooks leiningen.cljsbuild])
>
> I can successfully create a JAR from this with `lein install`, however if 
> I try to use this library as dependency in another CLJS project, none of 
> the namespaces of this dependency seem to be found, even though I verified 
> that they're present in the JAR (contains both .clj & .cljs versions).
>
> So I then assumed the reasons for this are the non-standard names for the 
> source folders. But adding this line at the root level of project.clj will 
> not work either and makes `lein install` fail with a 
> "java.util.zip.ZipException: duplicate entry":
>
> :source-paths ["src-clj" "src-cljs"]
>
> Therefore can someone please explain or point me to a correct project 
> setup to make this work? I've been trying to find answers on SO & Google, 
> but it seems this (strangely?) isn't a popular use case and I couldn't find 
> any helpful answers.
>
> Once this is solved am happy to write up a short tutorial or create a lein 
> template for future reference.
>
> Thank you!
> 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
--- 
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: query on clojure maps / vectors

2014-02-13 Thread David Jagoe
Would this work for you?

http://clojure.github.io/clojure/clojure.set-api.html

(in particular select for your example)


On 13 February 2014 17:27, t x  wrote:

> Hi,
>
> Preemptive: :-)
>
>   * I'm not looking for datomic.
>   * I'm also not looking for sqlkorma.
>
>   * An "in-memory" data-log might be what I'm after.
>
> Context:
>
>   I'm reading:
> http://code.kx.com/wiki/JB:QforMortals2/tables
>
>   and it struck me -- why can't I view a clojure {vector,list} of maps
> as a table? I.e.:
>
>   [{:tag :animal :type :dog :age 2}
>   {:tag :animal :type :cat :age 4}]
>
>   then do queries on things like:
>
> "get me all vector-indices of cats' of age >= 3"
>
> Question:
>
>   Is there a library (or even a blog post) about doing sql-like
> querying on _in memory clojure data structures_ ?
>
> 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.
>



-- 
David Jagoe

davidja...@gmail.com
+18053284389

-- 
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: query on clojure maps / vectors

2014-02-13 Thread David Jagoe
Here's an example:

http://www.bagdemir.com/2013/07/30/implementing-relational-algebra-in-clojure/


On 13 February 2014 18:32, David Jagoe  wrote:

> Would this work for you?
>
> http://clojure.github.io/clojure/clojure.set-api.html
>
> (in particular select for your example)
>
>
> On 13 February 2014 17:27, t x  wrote:
>
>> Hi,
>>
>> Preemptive: :-)
>>
>>   * I'm not looking for datomic.
>>   * I'm also not looking for sqlkorma.
>>
>>   * An "in-memory" data-log might be what I'm after.
>>
>> Context:
>>
>>   I'm reading:
>> http://code.kx.com/wiki/JB:QforMortals2/tables
>>
>>   and it struck me -- why can't I view a clojure {vector,list} of maps
>> as a table? I.e.:
>>
>>   [{:tag :animal :type :dog :age 2}
>>   {:tag :animal :type :cat :age 4}]
>>
>>   then do queries on things like:
>>
>> "get me all vector-indices of cats' of age >= 3"
>>
>> Question:
>>
>>   Is there a library (or even a blog post) about doing sql-like
>> querying on _in memory clojure data structures_ ?
>>
>> 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.
>>
>
>
>
> --
> David Jagoe
>
> davidja...@gmail.com
> +18053284389
>



-- 
David Jagoe

davidja...@gmail.com
+18053284389

-- 
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: query on clojure maps / vectors

2014-02-13 Thread Jeb Beich
You sure this isn't what you're looking for?

https://gist.github.com/stuarthalloway/2645453


On Thu, Feb 13, 2014 at 8:34 PM, David Jagoe  wrote:

> Here's an example:
>
>
> http://www.bagdemir.com/2013/07/30/implementing-relational-algebra-in-clojure/
>
>
> On 13 February 2014 18:32, David Jagoe  wrote:
>
>> Would this work for you?
>>
>> http://clojure.github.io/clojure/clojure.set-api.html
>>
>> (in particular select for your example)
>>
>>
>> On 13 February 2014 17:27, t x  wrote:
>>
>>> Hi,
>>>
>>> Preemptive: :-)
>>>
>>>   * I'm not looking for datomic.
>>>   * I'm also not looking for sqlkorma.
>>>
>>>   * An "in-memory" data-log might be what I'm after.
>>>
>>> Context:
>>>
>>>   I'm reading:
>>> http://code.kx.com/wiki/JB:QforMortals2/tables
>>>
>>>   and it struck me -- why can't I view a clojure {vector,list} of maps
>>> as a table? I.e.:
>>>
>>>   [{:tag :animal :type :dog :age 2}
>>>   {:tag :animal :type :cat :age 4}]
>>>
>>>   then do queries on things like:
>>>
>>> "get me all vector-indices of cats' of age >= 3"
>>>
>>> Question:
>>>
>>>   Is there a library (or even a blog post) about doing sql-like
>>> querying on _in memory clojure data structures_ ?
>>>
>>> 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.
>>>
>>
>>
>>
>> --
>> David Jagoe
>>
>> davidja...@gmail.com
>> +18053284389
>>
>
>
>
> --
> David Jagoe
>
> davidja...@gmail.com
> +18053284389
>
> --
> 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.


ANN: om-sync

2014-02-13 Thread David Nolen
I've been banging the drum about Om & modularity for a while now and I've
come up with the very beginning of a simple reusable component that I think
demonstrates the power of Om's emphasis on modularity and application wide
state management:

http://github.com/swannodette/om-sync

The whole point of Om is to create a universe of shareable components. I
hope this gets people thinking about the possibilities.

Feedback welcome!

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 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: CLJX & CLJS problem

2014-02-13 Thread Dave Della Costa
Hi Karsten,

Strangely, I was doing the exact same thing as you yesterday and
struggled for a bit until I found settings that work.

I achieved success when I used the configuration from Cornice as a template:

https://github.com/rkneufeld/cornice/blob/master/project.clj

...with one exception, my cljsbuild config contained only

:cljsbuild {:builds [{:source-paths ["target/generated/cljs"]}]}

vs. all the extra jar config and one not.  If I recall correctly, I was
getting the "java.util.zip.ZipException: duplicate entry" you mention
until I removed the extra settings in cljsbuild.

Looking at your config I also suspect you want

> :source-paths ["src-cljs"]

instead of

> :source-paths ["src-clj" "src-cljs"]

in your cljsbuild config.

However, when I leave the cljsbuild configuration out completely, it
seems to have no bearing on whether or not I can use the generated cljs
files when including the library in another project.  I suspect the
":jar true" setting is only relevant if you have strictly cljs files
that need to be included--it seems like cljx has its own orthogonal
build process which automatically includes cljs files in the jar file
but I haven't dug into the code yet to confirm.  This is just based on
testing what happens when I tweak config settings (Kevin or Chas please
let me know if I'm off-base here).

What does seem to make all the difference is the sourcepaths settings,
which it doesn't seem you have:

:source-paths ["src" "target/generated-src/clj" "target/generated-src/cljs"]

I needed this before I could see the clj/cljs files getting included in
my library jar.

Obviously, adjust all paths to fit your specific configuration.

I've made a pull request to add a bit of further explanation on using
cljx in libraries, as it would be helpful if this didn't require looking
up how others had done it to figure it out!

https://github.com/lynaghk/cljx/pull/30

Hope this helps--

Best,
Dave

(2014/02/13 20:22), Karsten Schmidt wrote:
> I've been busy working on a few libraries targetting both Clojure &
> ClojureScript, however so far have only tested the CLJ side and now that
> it comes to addressing CLJS am running in circles (and on fumes)
> unsuccessfully trying to tweak my project settings to make things work.
> 
> All my source is using CLJX stored in the the "src-cljx" folder. My
> rules then trigger generated sources into "src-clj" (for all Clojure and
> shared macros) and "src-cljs" for CLJS parts only.
> 
> My project.clj is as follows:
> 
> (defproject foo "0.1.0-SNAPSHOT"
>   :dependencies [[org.clojure/clojure "1.5.1"]
>  [org.clojure/clojurescript "0.0-2156"]]
>  
>   :jar-exclusions [#"\.cljx|\.DS_Store|\.js|\.html"]
> 
>   :cljx {:builds [{:source-paths ["src-cljx"]
>:output-path "src-clj"
>:rules :clj}
>   {:source-paths ["src-cljx"]
>:output-path "src-cljs"
>:rules :cljs}]}
> 
>   :cljsbuild {:builds
>   [{:id "dev"
> :source-paths ["src-clj" "src-cljs"]
> :compiler
> {:pretty-print true
>  :output-to "foo-0.1.0-SNAPSHOT.js"
>  :optimizations :simple}
> :jar true}]}
> 
>   :plugins [[com.keminglabs/cljx "0.3.2"]
> [lein-cljsbuild "1.0.2"]]
>   :hooks [cljx.hooks leiningen.cljsbuild])
> 
> I can successfully create a JAR from this with `lein install`, however
> if I try to use this library as dependency in another CLJS project, none
> of the namespaces of this dependency seem to be found, even though I
> verified that they're present in the JAR (contains both .clj & .cljs
> versions).
> 
> So I then assumed the reasons for this are the non-standard names for
> the source folders. But adding this line at the root level of
> project.clj will not work either and makes `lein install` fail with a
> "java.util.zip.ZipException: duplicate entry":
> 
> :source-paths ["src-clj" "src-cljs"]
> 
> Therefore can someone please explain or point me to a correct project
> setup to make this work? I've been trying to find answers on SO &
> Google, but it seems this (strangely?) isn't a popular use case and I
> couldn't find any helpful answers.
> 
> Once this is solved am happy to write up a short tutorial or create a
> lein template for future reference.
> 
> Thank you!
> 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
> ---
> 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

ANN: Om 0.4.0

2014-02-13 Thread David Nolen
Happy to announce a new release of Om. There are some breaking changes
mostly to make the API more uniform - om.core/root was needlessly different
from om.core/build.

The biggest and most exciting change is the inclusion of the :tx-listen
option to om.core/root. This will setup a callback which will be invoked
whenever an app state transaction occurs. This function will receive a map
tx-data which will include the :path that changed, :old-value and
:new-value on that path, :new-state and :old-state which is the entire
application (useful for rollbacks), and :tag if one was provided by the
transact! / update! call.

It's extremely powerful to make a subscribeable channel out of this and
share it over your entire application via om.core/root's :shared option.
This is exactly what the reusable om-sync component does http.://
github.com/swannodette/om-sync.

For a full list of changes, bug fixes, and enhancements:

http://github.com/swannodette/om/blob/master/CHANGES.md

Feedback welcome!

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 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: query on clojure maps / vectors

2014-02-13 Thread t x
@David:
  * set operations is not what I'm looking for
  * the relational algebra blog was very useful

@Jeb:
  * Ha! I didn't know that q could be used separate of datomic. I
might just use datomic after all.

Thanks!

On Thu, Feb 13, 2014 at 6:43 PM, Jeb Beich  wrote:
> You sure this isn't what you're looking for?
>
> https://gist.github.com/stuarthalloway/2645453
>
>
> On Thu, Feb 13, 2014 at 8:34 PM, David Jagoe  wrote:
>>
>> Here's an example:
>>
>>
>> http://www.bagdemir.com/2013/07/30/implementing-relational-algebra-in-clojure/
>>
>>
>> On 13 February 2014 18:32, David Jagoe  wrote:
>>>
>>> Would this work for you?
>>>
>>> http://clojure.github.io/clojure/clojure.set-api.html
>>>
>>> (in particular select for your example)
>>>
>>>
>>> On 13 February 2014 17:27, t x  wrote:

 Hi,

 Preemptive: :-)

   * I'm not looking for datomic.
   * I'm also not looking for sqlkorma.

   * An "in-memory" data-log might be what I'm after.

 Context:

   I'm reading:
 http://code.kx.com/wiki/JB:QforMortals2/tables

   and it struck me -- why can't I view a clojure {vector,list} of maps
 as a table? I.e.:

   [{:tag :animal :type :dog :age 2}
   {:tag :animal :type :cat :age 4}]

   then do queries on things like:

 "get me all vector-indices of cats' of age >= 3"

 Question:

   Is there a library (or even a blog post) about doing sql-like
 querying on _in memory clojure data structures_ ?

 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.
>>>
>>>
>>>
>>>
>>> --
>>> David Jagoe
>>>
>>> davidja...@gmail.com
>>> +18053284389
>>
>>
>>
>>
>> --
>> David Jagoe
>>
>> davidja...@gmail.com
>> +18053284389
>>
>> --
>> 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.

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