Check if value is a ring handler

2016-01-26 Thread JvJ
Is there a way to dynamically check whether or not a given function 
qualifies as a ring handler?

-- 
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/d/optout.


How to use plain Clojure functions in core.logic?

2016-01-26 Thread 良ϖ
Hi everybody,

I have defined a plain Clojure function which has a specific logic
inside. It outputs a mutated state given an initial state and some
other arguments. Basically, we could say it is like: (defn modifier
[basic x y value] (assoc-in basic [x y] value))

I want core.logic to deal with it in order to find the correct
parameters for this function to output the result I want. Do I have to
rewrite it as defne or defnc? methinks it would be a burden (just try
to express assoc-in in pure logic) >< so I'd like to find another way.
Maybe I could use the (for ) list comprehension but I feel like
core.logic has a more clever approach.

I have a gist with minimal working code sample here:
https://gist.github.com/piotr-yuxuan/fa0cfdc63a26b667c3f3

Will appreciate any help I would be given! :-) Thanks a lot in advance!

胡雨軒

-- 
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/d/optout.


Re: clojurescript in clojure

2016-01-26 Thread Matching Socks
Is lein's project mavenry important here?  Could you call cljs.compiler 
directly?

-- 
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/d/optout.


Re: macro question

2016-01-26 Thread Matching Socks
A macro emits a form for the compiler to compile.  And it understands its 
inputs as forms -- unevaluated forms.

 - Your plus-two emits a list with + in function position.

 - foo, when it is computing the form to emit, applies + to 2 and some form 
x. So 5 works but u does not, even after (def u 10), because the macro 
receives u as a form and not the value u was bound to.  

 - bar, when it is computing the form to emit, does as you say; it throws 
away the '+ symbol and the 2, emitting the form given by x. 


-- 
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/d/optout.


Re: macro question

2016-01-26 Thread echigoyamontoya
Thanks for your reply. I guess I was forgetting that at macroexpansion time 
(if I'm using the word correctly), we don't have access to the binding 
between u and 10. The same error I message I noted above does appear for (+ 
2 'u).

And, if I understand correctly, what was really happening with the macro 
bar was that in ('+ 2 'u), '+ was looking itself up in 2, not finding 
itself, and so returning the default value 'u. This was the expansion of 
the macro, and so at run time, it was bound to 10.

I think.

On Tuesday, January 26, 2016 at 2:02:22 PM UTC-8, Dan Burton wrote:
>
> > I know that this macro will add 2 to its argument:
>
> This isn't what that macro does. That macro takes a piece of syntax, and 
> sticks that syntax in the hole in the expression (+ 2 HOLE). The 
> macro doesn't evaluate the expression, it just generates it. It is the 
> evaluation of *that* expression that yields the plus-two result.
>
> The arguments to a macro are not values, they are syntax. The result of a 
> macro isn't a value, it's syntax. When you call (foo u), you are not 
> passing the value of u into the macro. You are passing in the syntactic 
> symbol u. That's why it says you can't add a Symbol to a Number. Your macro 
> is trying to compute (at "compile time") (+ 2 'u). 
>
> On Tuesday, January 26, 2016, > wrote:
>
>> I'm new to clojure and macros and am having trouble wrapping my head 
>> around some simple things.
>>
>> I know that this macro will add 2 to its argument:
>>
>> user=> (defmacro plus-two [x] `(+ 2 ~x))
>> #'user/plus-two
>> user=> (plus-two 5)
>> 7
>> user=> (def u 10)
>> #'user/u
>> user=> (plus-two u)
>> 12
>>
>> I tried the following just to see what will happen and don't understand 
>> what's going on:
>>
>> user=> (defmacro foo [x] (+ 2 x))
>> #'user/foo
>> user=> (foo 5)
>> 7
>> user=> (foo u)
>>
>> ClassCastException clojure.lang.Symbol cannot be cast to 
>> java.lang.Number  clojure.lang.Numbers.add (Numbers.java:128)
>>
>> I tried quoting the plus:
>>
>> user=> (defmacro bar [x] ('+ 2 x))
>> #'user/bar
>> user=> (bar 5)
>> 5
>> user=> (bar u)
>> 10
>>
>> This makes sense, since (bar u) is the same as + 2 u (without 
>> parentheses), which returns u. But I don't understand what's happening with 
>> foo, and I can't check it with macroexpand since that gives the same error. 
>> Is there a way to recreate this error without defining a macro?
>>
>> Thanks in advance for any and all responses.
>>
>>
>> -- 
>> 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/d/optout.
>>
>
>
> -- 
> -- Dan Burton
>

-- 
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/d/optout.


[ANN] aautil 0.0.3--lightweight cljc lenses

2016-01-26 Thread William la Forge
AAUTIL is a collection of cljc snippets intended to make writing cljc code 
easier. It includes code for logging, ultra-light component lifecycle 
support, and now lenses.
https://github.com/aatree/aautil

For each snippet there is also a demo written using hoplon.
https://github.com/aatree/aademos

-- 
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/d/optout.


Re: [ANN] fudje - unit testing library vaguely resembling midje, but with less 'calories'

2016-01-26 Thread Brian Marick

dimitris wrote:

This is a small testing library inspired by midje.


For what it's worth, I (author of Midje) think this is wonderful.

You might consider emphasizing that you have similar checkers, as I 
think that's one of Midje's strong points. I've been recently 
incorporating https://github.com/marick/structural-typing/ to get better 
error messages when checking collections. Like this:



The checker said this about the reason:
[0 :a :b] should be `even?`; it is `1`
[1 :c] must exist and be non-nil
[2 :a :b] should be `neg?`; it is `2`


Otherwise:


1) The implementation is utterly intimidating (i' ve heard this from
plenty other people)


Yeah. It started as my project to learn Clojure, so it's not... um... 
the way I write code today.



2) Doesn't play nicely with AOT


At two companies, I've used Midje and deployed AOT-compiled uberjars. It 
would be interesting to have a specific example of the problem.


--
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/d/optout.


Re: Java API type hint question

2016-01-26 Thread Ritchie Cai
Good to know, thanks.

On Tuesday, January 26, 2016 at 5:11:48 PM UTC-6, Gary Trakhman wrote:
>
> Just because no else has said it yet, clojure vectors, lists and seqs all 
> implement the read part of the interface java.util.List, and your java API 
> should most likely be refactored to use the List interface instead of 
> ArrayList if it isn't already.
>
> If that's the case, and it's not trying to mutate what's passed in (any 
> well-designed java api should only read from collections or defensively 
> copy first), you can just pass the clojure collection to the java api as is.
>
> On Tue, Jan 26, 2016 at 5:58 PM Beau Fabry > 
> wrote:
>
>> Tell the compiler that the type you're passing to the constructor is a 
>> Collection, so it will know which constructor to use without reflection.
>>
>> (set! *warn-on-reflection* true)
>> => true
>> (import '(java.util ArrayList Collection))
>> => java.util.Collection
>> (ArrayList. (list 1 2))
>> Reflection warning, 
>> /Users/bfabry/Library/Caches/IdeaIC15/tmp/form-init108635367050123227.clj:1:1
>>  
>> - call to java.util.ArrayList ctor can't be resolved.
>> => [1 2]
>> (ArrayList. ^Collection (list 1 2))
>> => [1 2]
>>
>>
>>
>> On Tuesday, January 26, 2016 at 1:56:19 PM UTC-8, Ritchie Cai wrote:
>>>
>>> Quoting for small example like I mention is not an issue, but in 
>>> general, I need to pass an vector or list, since that's what I get, in 
>>> which case I cannot quote. 
>>>
>>> On Tuesday, January 26, 2016 at 3:52:17 PM UTC-6, Michael Willis wrote:

 What's not practical about quoting?  I thought it was considered more 
 idiomatic than doing (list ...)

 On Sunday, January 17, 2016 at 2:48:29 PM UTC-6, Ritchie Cai wrote:
>
> Hi all,
>
> I'm trying to create a Java ArrayList object from a Clojure collection 
> to pass to another Java API. I get reflection warnings when the elements 
> are not primitive types, in this case I'm using SparseIndexedVector 
> class from vectorz library.
>
> (ArrayList. [c0 c1 c2])
> Reflection warning, *cider-repl localhost*:77:11 - call to 
> java.util.ArrayList ctor can't be resolved.
>
> where c0 c1 c2 are of type SparseIndexedVector. Alternatively, I can 
> create create ArrayList then add elements one by one in a loop.
>
> (doto (ArrayList.)
>(.add c0)
>(.add c1)
>(.add c2))
>
> But I'm wondering if there is away to get rid of the the reflection 
> warning when calling ArrayList constructor. 
>
> Also, quoting a list will not give reflection warning:
>
> (ArrayList. '(c0 c1 c2))  ;; no warning
>
> (ArrayList. (list c0 c1 c2)) 
> Reflection warning, *cider-repl localhost*:77:11 - call to 
> java.util.ArrayList ctor can't be resolved.
>
> However, quoting is not very practical.
>
> Thanks
> Ritchie
>
> -- 
>> 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/d/optout.
>>
>

-- 
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/d/optout.


Re: Java API type hint question

2016-01-26 Thread Ritchie Cai
Ahh, thanks. I was wondering how to specify Collection 
https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html>>, but 
looks like just Collection will work.

On Tuesday, January 26, 2016 at 4:57:53 PM UTC-6, Beau Fabry wrote:
>
> Tell the compiler that the type you're passing to the constructor is a 
> Collection, so it will know which constructor to use without reflection.
>
> (set! *warn-on-reflection* true)
> => true
> (import '(java.util ArrayList Collection))
> => java.util.Collection
> (ArrayList. (list 1 2))
> Reflection warning, 
> /Users/bfabry/Library/Caches/IdeaIC15/tmp/form-init108635367050123227.clj:1:1 
> - call to java.util.ArrayList ctor can't be resolved.
> => [1 2]
> (ArrayList. ^Collection (list 1 2))
> => [1 2]
>
>
>
> On Tuesday, January 26, 2016 at 1:56:19 PM UTC-8, Ritchie Cai wrote:
>>
>> Quoting for small example like I mention is not an issue, but in general, 
>> I need to pass an vector or list, since that's what I get, in which case I 
>> cannot quote. 
>>
>> On Tuesday, January 26, 2016 at 3:52:17 PM UTC-6, Michael Willis wrote:
>>>
>>> What's not practical about quoting?  I thought it was considered more 
>>> idiomatic than doing (list ...)
>>>
>>> On Sunday, January 17, 2016 at 2:48:29 PM UTC-6, Ritchie Cai wrote:

 Hi all,

 I'm trying to create a Java ArrayList object from a Clojure collection 
 to pass to another Java API. I get reflection warnings when the elements 
 are not primitive types, in this case I'm using SparseIndexedVector 
 class from vectorz library.

 (ArrayList. [c0 c1 c2])
 Reflection warning, *cider-repl localhost*:77:11 - call to 
 java.util.ArrayList ctor can't be resolved.

 where c0 c1 c2 are of type SparseIndexedVector. Alternatively, I can 
 create create ArrayList then add elements one by one in a loop.

 (doto (ArrayList.)
(.add c0)
(.add c1)
(.add c2))

 But I'm wondering if there is away to get rid of the the reflection 
 warning when calling ArrayList constructor. 

 Also, quoting a list will not give reflection warning:

 (ArrayList. '(c0 c1 c2))  ;; no warning

 (ArrayList. (list c0 c1 c2)) 
 Reflection warning, *cider-repl localhost*:77:11 - call to 
 java.util.ArrayList ctor can't be resolved.

 However, quoting is not very practical.

 Thanks
 Ritchie



-- 
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/d/optout.


Re: Java API type hint question

2016-01-26 Thread Gary Trakhman
Just because no else has said it yet, clojure vectors, lists and seqs all
implement the read part of the interface java.util.List, and your java API
should most likely be refactored to use the List interface instead of
ArrayList if it isn't already.

If that's the case, and it's not trying to mutate what's passed in (any
well-designed java api should only read from collections or defensively
copy first), you can just pass the clojure collection to the java api as is.

On Tue, Jan 26, 2016 at 5:58 PM Beau Fabry  wrote:

> Tell the compiler that the type you're passing to the constructor is a
> Collection, so it will know which constructor to use without reflection.
>
> (set! *warn-on-reflection* true)
> => true
> (import '(java.util ArrayList Collection))
> => java.util.Collection
> (ArrayList. (list 1 2))
> Reflection warning,
> /Users/bfabry/Library/Caches/IdeaIC15/tmp/form-init108635367050123227.clj:1:1
> - call to java.util.ArrayList ctor can't be resolved.
> => [1 2]
> (ArrayList. ^Collection (list 1 2))
> => [1 2]
>
>
>
> On Tuesday, January 26, 2016 at 1:56:19 PM UTC-8, Ritchie Cai wrote:
>>
>> Quoting for small example like I mention is not an issue, but in general,
>> I need to pass an vector or list, since that's what I get, in which case I
>> cannot quote.
>>
>> On Tuesday, January 26, 2016 at 3:52:17 PM UTC-6, Michael Willis wrote:
>>>
>>> What's not practical about quoting?  I thought it was considered more
>>> idiomatic than doing (list ...)
>>>
>>> On Sunday, January 17, 2016 at 2:48:29 PM UTC-6, Ritchie Cai wrote:

 Hi all,

 I'm trying to create a Java ArrayList object from a Clojure collection
 to pass to another Java API. I get reflection warnings when the elements
 are not primitive types, in this case I'm using SparseIndexedVector
 class from vectorz library.

 (ArrayList. [c0 c1 c2])
 Reflection warning, *cider-repl localhost*:77:11 - call to
 java.util.ArrayList ctor can't be resolved.

 where c0 c1 c2 are of type SparseIndexedVector. Alternatively, I can
 create create ArrayList then add elements one by one in a loop.

 (doto (ArrayList.)
(.add c0)
(.add c1)
(.add c2))

 But I'm wondering if there is away to get rid of the the reflection
 warning when calling ArrayList constructor.

 Also, quoting a list will not give reflection warning:

 (ArrayList. '(c0 c1 c2))  ;; no warning

 (ArrayList. (list c0 c1 c2))
 Reflection warning, *cider-repl localhost*:77:11 - call to
 java.util.ArrayList ctor can't be resolved.

 However, quoting is not very practical.

 Thanks
 Ritchie

 --
> 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/d/optout.
>

-- 
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/d/optout.


Re: Java API type hint question

2016-01-26 Thread Beau Fabry
Tell the compiler that the type you're passing to the constructor is a 
Collection, so it will know which constructor to use without reflection.

(set! *warn-on-reflection* true)
=> true
(import '(java.util ArrayList Collection))
=> java.util.Collection
(ArrayList. (list 1 2))
Reflection warning, 
/Users/bfabry/Library/Caches/IdeaIC15/tmp/form-init108635367050123227.clj:1:1 
- call to java.util.ArrayList ctor can't be resolved.
=> [1 2]
(ArrayList. ^Collection (list 1 2))
=> [1 2]



On Tuesday, January 26, 2016 at 1:56:19 PM UTC-8, Ritchie Cai wrote:
>
> Quoting for small example like I mention is not an issue, but in general, 
> I need to pass an vector or list, since that's what I get, in which case I 
> cannot quote. 
>
> On Tuesday, January 26, 2016 at 3:52:17 PM UTC-6, Michael Willis wrote:
>>
>> What's not practical about quoting?  I thought it was considered more 
>> idiomatic than doing (list ...)
>>
>> On Sunday, January 17, 2016 at 2:48:29 PM UTC-6, Ritchie Cai wrote:
>>>
>>> Hi all,
>>>
>>> I'm trying to create a Java ArrayList object from a Clojure collection 
>>> to pass to another Java API. I get reflection warnings when the elements 
>>> are not primitive types, in this case I'm using SparseIndexedVector 
>>> class from vectorz library.
>>>
>>> (ArrayList. [c0 c1 c2])
>>> Reflection warning, *cider-repl localhost*:77:11 - call to 
>>> java.util.ArrayList ctor can't be resolved.
>>>
>>> where c0 c1 c2 are of type SparseIndexedVector. Alternatively, I can 
>>> create create ArrayList then add elements one by one in a loop.
>>>
>>> (doto (ArrayList.)
>>>(.add c0)
>>>(.add c1)
>>>(.add c2))
>>>
>>> But I'm wondering if there is away to get rid of the the reflection 
>>> warning when calling ArrayList constructor. 
>>>
>>> Also, quoting a list will not give reflection warning:
>>>
>>> (ArrayList. '(c0 c1 c2))  ;; no warning
>>>
>>> (ArrayList. (list c0 c1 c2)) 
>>> Reflection warning, *cider-repl localhost*:77:11 - call to 
>>> java.util.ArrayList ctor can't be resolved.
>>>
>>> However, quoting is not very practical.
>>>
>>> Thanks
>>> Ritchie
>>>
>>>

-- 
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/d/optout.


Re: macro question

2016-01-26 Thread Dan Burton
> I know that this macro will add 2 to its argument:

This isn't what that macro does. That macro takes a piece of syntax, and
sticks that syntax in the hole in the expression (+ 2 HOLE). The
macro doesn't evaluate the expression, it just generates it. It is the
evaluation of *that* expression that yields the plus-two result.

The arguments to a macro are not values, they are syntax. The result of a
macro isn't a value, it's syntax. When you call (foo u), you are not
passing the value of u into the macro. You are passing in the syntactic
symbol u. That's why it says you can't add a Symbol to a Number. Your macro
is trying to compute (at "compile time") (+ 2 'u).

On Tuesday, January 26, 2016,  wrote:

> I'm new to clojure and macros and am having trouble wrapping my head
> around some simple things.
>
> I know that this macro will add 2 to its argument:
>
> user=> (defmacro plus-two [x] `(+ 2 ~x))
> #'user/plus-two
> user=> (plus-two 5)
> 7
> user=> (def u 10)
> #'user/u
> user=> (plus-two u)
> 12
>
> I tried the following just to see what will happen and don't understand
> what's going on:
>
> user=> (defmacro foo [x] (+ 2 x))
> #'user/foo
> user=> (foo 5)
> 7
> user=> (foo u)
>
> ClassCastException clojure.lang.Symbol cannot be cast to java.lang.Number
> clojure.lang.Numbers.add (Numbers.java:128)
>
> I tried quoting the plus:
>
> user=> (defmacro bar [x] ('+ 2 x))
> #'user/bar
> user=> (bar 5)
> 5
> user=> (bar u)
> 10
>
> This makes sense, since (bar u) is the same as + 2 u (without
> parentheses), which returns u. But I don't understand what's happening with
> foo, and I can't check it with macroexpand since that gives the same error.
> Is there a way to recreate this error without defining a macro?
>
> Thanks in advance for any and all responses.
>
>
> --
> 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/d/optout.
>


-- 
-- Dan Burton

-- 
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/d/optout.


Re: Java API type hint question

2016-01-26 Thread Ritchie Cai
Quoting for small example like I mention is not an issue, but in general, I 
need to pass an vector or list, since that's what I get, in which case I 
cannot quote. 

On Tuesday, January 26, 2016 at 3:52:17 PM UTC-6, Michael Willis wrote:
>
> What's not practical about quoting?  I thought it was considered more 
> idiomatic than doing (list ...)
>
> On Sunday, January 17, 2016 at 2:48:29 PM UTC-6, Ritchie Cai wrote:
>>
>> Hi all,
>>
>> I'm trying to create a Java ArrayList object from a Clojure collection to 
>> pass to another Java API. I get reflection warnings when the elements are 
>> not primitive types, in this case I'm using SparseIndexedVector class 
>> from vectorz library.
>>
>> (ArrayList. [c0 c1 c2])
>> Reflection warning, *cider-repl localhost*:77:11 - call to 
>> java.util.ArrayList ctor can't be resolved.
>>
>> where c0 c1 c2 are of type SparseIndexedVector. Alternatively, I can 
>> create create ArrayList then add elements one by one in a loop.
>>
>> (doto (ArrayList.)
>>(.add c0)
>>(.add c1)
>>(.add c2))
>>
>> But I'm wondering if there is away to get rid of the the reflection 
>> warning when calling ArrayList constructor. 
>>
>> Also, quoting a list will not give reflection warning:
>>
>> (ArrayList. '(c0 c1 c2))  ;; no warning
>>
>> (ArrayList. (list c0 c1 c2)) 
>> Reflection warning, *cider-repl localhost*:77:11 - call to 
>> java.util.ArrayList ctor can't be resolved.
>>
>> However, quoting is not very practical.
>>
>> Thanks
>> Ritchie
>>
>>

-- 
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/d/optout.


Re: Java API type hint question

2016-01-26 Thread Michael Willis
What's not practical about quoting?  I thought it was considered more 
idiomatic than doing (list ...)

On Sunday, January 17, 2016 at 2:48:29 PM UTC-6, Ritchie Cai wrote:
>
> Hi all,
>
> I'm trying to create a Java ArrayList object from a Clojure collection to 
> pass to another Java API. I get reflection warnings when the elements are 
> not primitive types, in this case I'm using SparseIndexedVector class 
> from vectorz library.
>
> (ArrayList. [c0 c1 c2])
> Reflection warning, *cider-repl localhost*:77:11 - call to 
> java.util.ArrayList ctor can't be resolved.
>
> where c0 c1 c2 are of type SparseIndexedVector. Alternatively, I can 
> create create ArrayList then add elements one by one in a loop.
>
> (doto (ArrayList.)
>(.add c0)
>(.add c1)
>(.add c2))
>
> But I'm wondering if there is away to get rid of the the reflection 
> warning when calling ArrayList constructor. 
>
> Also, quoting a list will not give reflection warning:
>
> (ArrayList. '(c0 c1 c2))  ;; no warning
>
> (ArrayList. (list c0 c1 c2)) 
> Reflection warning, *cider-repl localhost*:77:11 - call to 
> java.util.ArrayList ctor can't be resolved.
>
> However, quoting is not very practical.
>
> Thanks
> Ritchie
>
>

-- 
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/d/optout.


Re: [ANN] Brute 0.4.0 - A lightweight Entity Component System library for writing games

2016-01-26 Thread Michael Willis
Nice!  I'm curious if you have thought of any way to index the entities by 
component values.  For example, let's say your game has thousands of 
entities, and you want to write a system that does something with all 
entities in proximity of a given location, or maybe it does something to 
all entities with health less than 10%.  It would be nice if the systems 
didn't have to filter through thousands of entities.

On Thursday, January 21, 2016 at 8:14:35 PM UTC-6, Mark Mandel wrote:
>
> Brute is a simple and lightweight Entity Component System library for 
> writing games with Clojure and ClojureScript.
>
> This release is essentially just a move from CLJX to Reader Conditionals 
> to implement support for both CLJ and CLJS.
>
> Full details, and how the conversation process went can be found in the 
> full blog post:
> http://www.compoundtheory.com/brute-0-4-0-from-cljx-to-reader-conditionals/
>
> Project can be found on Github at:
> https://github.com/markmandel/brute
>
> As always feedback and pull requests are welcome.
>
> -- 
> E: mark@gmail.com 
> T: http://www.twitter.com/neurotic
> W: www.compoundtheory.com
>
> 2 Devs from Down Under Podcast
> http://www.2ddu.com/
>

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


macro question

2016-01-26 Thread echigoyamontoya
I'm new to clojure and macros and am having trouble wrapping my head around 
some simple things.

I know that this macro will add 2 to its argument:

user=> (defmacro plus-two [x] `(+ 2 ~x))
#'user/plus-two
user=> (plus-two 5)
7
user=> (def u 10)
#'user/u
user=> (plus-two u)
12

I tried the following just to see what will happen and don't understand 
what's going on:

user=> (defmacro foo [x] (+ 2 x))
#'user/foo
user=> (foo 5)
7
user=> (foo u)

ClassCastException clojure.lang.Symbol cannot be cast to java.lang.Number  
clojure.lang.Numbers.add (Numbers.java:128)

I tried quoting the plus:

user=> (defmacro bar [x] ('+ 2 x))
#'user/bar
user=> (bar 5)
5
user=> (bar u)
10

This makes sense, since (bar u) is the same as + 2 u (without parentheses), 
which returns u. But I don't understand what's happening with foo, and I 
can't check it with macroexpand since that gives the same error. Is there a 
way to recreate this error without defining a macro?

Thanks in advance for any and all responses.


-- 
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/d/optout.


[ANN] Specter 0.9.2

2016-01-26 Thread Nathan Marz
I just released Specter 0.9.2:

https://github.com/nathanmarz/specter
https://clojars.org/com.rpl/specter/versions/0.9.2

Specter solves a near-universal problem encountered when writing 
Clojure/ClojureScript: the need to transform or query a data structure 
that's more sophisticated than a basic map or list. It is a library that 
captures the notion of "navigation" within a data structure and allows for 
writing elegant queries and transformations. Its performance is close to 
hand-optimized code so it can be used even in performance-critical code. 
Additionally, Specter is extensible to any data structure as it is based on 
a simple protocol.

There have been over 15 releases since I last posted about Specter on the 
group (almost a year ago), and there's been a ton of improvements since 
then:

- Precompilation feature enabling performance rivaling hand-optimized code
- Facilities for creating recursive navigators, including pre-walk and 
post-walk traversals (declarepath/providepath, stay-then-continue, 
continue-then-stay)
- ClojureScript support
- Conditional navigation (if-path, cond-path)
- Protocol paths: navigate based on the type of data encountered
- "Batteries included" set of navigators that captures majority of use 
cases dealing with combinations of maps, lists, vectors, and sets

-- 
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/d/optout.


Re: clojure.compiler.disable-locals-clearing memory leak?

2016-01-26 Thread Mars0i
On Tuesday, January 26, 2016 at 3:51:09 AM UTC-6, icamts wrote:
>
> Are you using the same JVM? It's an optimization introduced at some point 
> in JVM GC. It can be turned off with the JVM flag -XX:-UseGCOverheadLimit. 
> See 
> https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks002.html
>
>
Yes, all on Java 8.  Thanks.  I thought about using that flag, but wanted 
to get to the bottom of the problem, and have now done so by turning off 
locals clearing.

-- 
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/d/optout.


clojurescript in clojure

2016-01-26 Thread Gregg Reynolds
I have some cljs fn forms embedded in some clj code.  Macros read the
stuff, munge it a bit, season to taste and generate cljs code.

At least that's the idea.  Mixing clj and cljs is a requirement, so
splitting the cljs into a .cljs file is not an option.  I'm not sure how
best to make it work, tho, so I thought I'd better ask around before I
start implementing something dumb.  The least dumb idea I've come up with
so far is to have the macros generate the cljs code and write it to a temp
file being watched by lein cljsbuild auto.  Is there a better way?

Thanks, Gregg

-- 
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/d/optout.


Re: Can anyone help with a jug problem in clojure

2016-01-26 Thread gianluca torta
Hi Steve,

this lookslike a typical problem that requires "artificial intelligence" 
(AI) search:
http://www.tutorialspoint.com/artificial_intelligence/artificial_intelligence_popular_search_algorithms.htm

once you have a general strategy based on the above algos in mind, a quite 
orthogonal problem is how to encode it and solve it in Clojure

looking forward to your thoughts

cheers,
Gianluca

On Tuesday, January 26, 2016 at 12:37:07 PM UTC+1, stevega...@gmail.com 
wrote:
>
> Hi, i am completely new to clojure and i have been given the task of 
> finding 3 different ways of solving the problem here: 
> https://uva.onlinejudge.org/external/5/571.html
>
> Im hoping that if someone can point me in right direction of a solution 
> hopefully ill be able to figure out the other 2 solutions from that
>
> 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/d/optout.


Re: Transduce with a minus '-'

2016-01-26 Thread Alex Miller
`completing` exists for exactly this purpose. :)

On Tuesday, January 26, 2016 at 1:22:30 AM UTC-6, Mark Tinsley wrote:
>
> Hi Alex, 
>
> Completing is exactly what I used to solve this, but It felt like a bit of 
> a hack/work around. 
>
> I think this is a case of being pragmatic, having the reason reaffirmed 
> makes it feel less like a work around and more of a choice in behaviour.
>
> Thanks 
>
> Mark
>
>
> On Monday, January 25, 2016 at 3:22:26 PM UTC, Alex Miller wrote:
>>
>> I think you've explained it well. You can use 
>> https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/completing
>>  
>> to patch in a better completion arity for - (here I think identity is what 
>> you want and that is the default for completing):
>>
>> (transduce xf (completing -) 0 (range 10))
>>  
>>
>>
>>
>> On Monday, January 25, 2016 at 7:12:42 AM UTC-6, Mark Tinsley wrote:
>>>
>>> Hi all,
>>>
>>> Could I have some clarification on something, I know how to solve the 
>>> issue I just want to make sure I understand the reasons behind it, given 
>>> the following:
>>>
>>> (def xf
>>>   (comp
>>>(filter odd?)
>>>(map inc)
>>>(take 5)))
>>>
>>>
>>> (transduce xf + 0 (range 10))
>>>
>>> I get the answer: => 30
>>>
>>> Makes sense, now if I do this:
>>>
>>> (transduce xf - 0 (range 10))
>>>
>>> I get the answer => 30
>>>
>>> But... 
>>>
>>> (reduce - 0 (eduction xf (range 10))) 
>>>
>>> gives => -30
>>>
>>> I can see why this is, looking at 
>>> https://github.com/clojure/clojure/blob/010864f8ed828f8d261807b7345f1a539c5b20df/src/clj/clojure/core.clj#L6587
>>>  
>>> the binding ret in the let has the reduced value. This is then passed to 
>>> the reducers arity-1 function, which preforms something equivalent to the 
>>> following (- -30) to give 30.
>>>
>>> The reason for the arity-1 function is to complete/cleanup state as seen 
>>> in the partition-all function 
>>> https://github.com/clojure/clojure/blob/010864f8ed828f8d261807b7345f1a539c5b20df/src/clj/clojure/core.clj#L6954
>>>
>>> As '-' historically had an arity-1 function we cannot update the 
>>> behaviour, this may well be the case for other functions. 
>>>
>>> Am I right in the above or am I missing something? 
>>>
>>> Thanks,
>>>
>>> Mark
>>>
>>>
>>>

-- 
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/d/optout.


Re: What's the best option similar to Vert.x, Reactor, Nodejs for use with Clojure?

2016-01-26 Thread qsys
Now, Pulsar looks something more like it: messaging, clustering between 
machines. It even feels a bit like what vertx is doing, at first glance. 
Having a kind of 'inter-machine core.async channels' is awesome. This can 
easily replace the 'vertx eventbus'. Really cool!

Thanks a lot, Fabio!
qsys

Op maandag 25 januari 2016 14:12:42 UTC+1 schreef Fabio T.:
>
> Hi,
>
> I agree it really depends what you're looking for. If you're especially 
> looking for async performance then I think you can't go wrong with Pulsar 
>  which is a Clojure language 
> integration module + a thin, idiomatic wrapper around Quasar 
>  (which supports Java and Kotlin 
>  for now, in future any JVM language). 
> Quasar/Pulsar give you fibers 
>  (so no need for async 
> APIs and related complications), Go-like channels 
> , Erlang-like actors 
>  and 
> dataflow 
> . 
> You can also mix threads and fibers freely (there's an integration of 
> java.util.concurrent 
> 
>  
> as well, should you be interested).
>
> With Pulsar you can have automatic instrumentation 
>  and 
> there are some useful Clojure/Pulsar-specific integrations in Comsat 
>  already, like a jetty-fiber 
> ring adapter  and a 
> fiber HTTP 
> client based on httpkit 
> . There's also a 
> full-blown core.async  
> implentation based on fibers, so you don't need to use "go" block to have 
> async-like performance.
>
> vert.x  itself now has an integration with Quasar 
> called vertx-sync  but for the 
> moment is Java-only.
>
> -- Fabio
>
> On Sunday, January 3, 2016 at 9:59:39 PM UTC+2, adrians wrote:
>>
>>
>> It used to be that Vert.x 2.x had integration for Clojure, but version 
>> 3.x hasn't added it yet. Has anyone used this version through the Java API 
>> and if so, how painful was it? Is Reactor any 
>> better in that respect? What are people using when they want this kind of 
>> back end?
>>
>

-- 
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/d/optout.


Figwheel-component and autoreloading source... how?

2016-01-26 Thread Vic Putz
Developing a wee "learning app" with duct/component/figwheel, using emacs 
and cider, and I've hit a snag.

I want the sexy auto-reloading of code that figwheel provides, but as the 
good Weavejester says 
in https://github.com/weavejester/duct-figwheel-component/issues/1, that's 
not a port of the duct figwheel-component component.  So I followed the 
suggestion of that thread and tried hawk.

Only... okay, I added "start-watch" into dev/user.clj:

(defn start-watch []
  (hawk/watch! [{:watcher :polling
 :paths ["src" "dev"]
 :filter (fn [ctx e] (is-srcfile (:file e)))
 :handler (fn [ctx e]
(println "File " (.getName (:file e)) 
"Changed")
(reloaded.repl/reset))}]))

This actually sorta works; it watches the directories and tells me if 
anything changes (is-srcfile just checks for .clj or .cljs extension so 
emacs temp files don't set off a cascade of resets).

user> (start-watch)
{:thread #object[java.lang.Thread 0x467d27f1 
"Thread[Thread-67,5,main]"], :watcher 
#object[sun.nio.fs.WindowsWatchService 0x5957d994 
"sun.nio.fs.WindowsWatchService@5957d994"]}
user> 

So a watcher is set up.  If I change user.clj and save it... well, nothing 
happens in my *cider-repl* frame, but in my *nrepl-server* frame, I get

File  user.clj Changed
:reloading (user)
 java.lang.IllegalStateException: Can't change/establish root binding 
of: *ns* with set
at clojure.lang.Var.set(Var.java:221)
at clojure.lang.RT$1.invoke(RT.java:241)
at clojure.tools.namespace.repl$do_refresh.invokeStatic(repl.clj:95)
at clojure.tools.namespace.repl$do_refresh.invoke(repl.clj:82)
at clojure.tools.namespace.repl$refresh.invokeStatic(repl.clj:145)
at clojure.tools.namespace.repl$refresh.doInvoke(repl.clj:128)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at reloaded.repl$reset.invokeStatic(repl.clj:53)
at reloaded.repl$reset.invoke(repl.clj:51)
at user$start_watch$fn__45776.invoke(user.clj:67)
...


So hawk is obviously watching my source tree and calling my handler 
function, but when reloaded.repl/reset is called, something is blowing up. 
 I can call (reset) directly in the *cider-repl* frame and it works fine.

But I'm obviously doing something horribly wrong, and it seems like it 
should be quite easy.  What am I missing here?  Should this be done 
somewhere besides user.clj?

-- 
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/d/optout.


Can anyone help with a jug problem in clojure

2016-01-26 Thread stevegarrid1234
Hi, i am completely new to clojure and i have been given the task of 
finding 3 different ways of solving the problem 
here: https://uva.onlinejudge.org/external/5/571.html

Im hoping that if someone can point me in right direction of a solution 
hopefully ill be able to figure out the other 2 solutions from that

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/d/optout.


Re: [ANN] New clojure.org!

2016-01-26 Thread Colin Yates
It’s probably just me but I always think tech companies that don’t do SSL 
reflects badly on them, like they couldn’t be bothered :-). Can’t really 
justify that prejudice, but anyways, glad this is working now.

(There is also 
http://searchengineland.com/google-starts-giving-ranking-boost-secure-httpsssl-sites-199446).

> On 26 Jan 2016, at 03:52, Alex Miller  wrote:
> 
> You can now access https://clojure.org, thanks for the push.
> 
> On Thursday, January 14, 2016 at 2:25:42 PM UTC-6, Alex Miller wrote:
> Noted, I will bump it up the priority list.
> 
> On Thursday, January 14, 2016 at 1:49:55 PM UTC-6, Laurens Van Houtven wrote:
> Hi,
> 
>> On Jan 14, 2016, at 12:34 PM, Alex Miller > > wrote:
>> 
>> The clojure.org  has never, and does not now, support 
>> https. It is an entirely static site, so it is not high on my priority list 
>> to work on.
> 
> Sure; but it does respond to HTTPS requests with a bogus cert, instead of 
> simply not supporting HTTPS at all.
> 
> Since it’s HTTP, an attacker on a local network can fairly trivially (by 
> which I mean: using off the shelf tools) make that “download Clojure” link 
> point to whatever they want, which is my main concern. 
> 
> I don’t know if this is an option for you, but CloudFlare will give you a 
> fairly hassle-free (and money-free) TLS termination option.
> 
> 
> lvh
> 
> 
> -- 
> 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/d/optout 
> .

-- 
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/d/optout.


Re: clojure.compiler.disable-locals-clearing memory leak?

2016-01-26 Thread icamts
Are you using the same JVM? It's an optimization introduced at some point 
in JVM GC. It can be turned off with the JVM flag -XX:-UseGCOverheadLimit. 
See 
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks002.html


Il giorno lunedì 25 gennaio 2016 07:49:03 UTC+1, Mars0i ha scritto:
>
> In my  application, I seem to get a memory leak when I use 
> -Dclojure.compiler.disable-locals-clearing=true in Clojure 1.7.0 and 1.8.0, 
> but not in 1.6.0.  (i.e. I get "java.lang.OutOfMemoryError: GC overhead 
> limit exceeded" with the more recent versions).
>
> Any guesses about why this might happen?  Just curious.  
>
> (I think I can live without disabling locals-clearing.  I don't fully 
> understand it.  Not sure why I started using it.  I don't use a debugger.)
>

-- 
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/d/optout.


Re: How do I access components of a system map

2016-01-26 Thread Jo Geraerts
Hey Collin,

Op zondag 15 maart 2015 17:26:10 UTC+1 schreef Colin Yates:
>
>
> How do the worker fns actually get called - the dispatching is up to 
> you - I tend to have a bus (or channel) which is the glue underneath 
> the gateway. 
>
> For example, I might have: 
>  - a command bus which needs a command registry 
>  - a number of handlers which each handle a command 
>
> I might have: 
>  - a CommandRegistry component which exposes the actual registry 
>  - a CommandOneHandler component which depends on the registry and 
> registers command-one-handler as the handler of CommandOne. It might 
> actually register a (partial command-one-handler collab-1 collab-2 
> etc.) 
>  - a CommandDispatcher component which takes the command registry, 
> listens to commands and then dispatches to the correct handler 
>
 
I have like exactly this. But one problem i have that you create a circular 
dependency between your Registry & Handlers which causes a StackOverflow 
when trying to print the Registry from the repl. Any solutions to 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/d/optout.