[ANN] debux 0.2.1 is out

2016-05-16 Thread Philos Kim
Debux is a small but useful library for debugging Clojure and ClojureScript.

https://github.com/philoskim/debux

Change Logs

Version 0.2.1 (minor bug fixes):
Fixed: An error fixed when using (clog (->> .))
Fixed: An error fixed when using (dbg (let [[a & b] [10 20 30]] ..))
Added: break usage

-- 
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: Ghosts in the machine

2016-05-16 Thread Sébastien Bocq
Thanks for sharing!
Sébastien

Le jeudi 12 mai 2016 02:13:07 UTC+2, Daniel Szmulewicz a écrit :
>
> Hi all, 
>
> The next version of system 0.3.0 is ready and it is a matter of days 
> before the official announcement. 
>
> In the meantime, here is a summary of the research that has been carried 
> around the Clojure runtime and code reloading.
>
> http://danielsz.github.io/2016/05/06/Ghosts-in-the-machine
>
> Enjoy!
>
>
>

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

2016-05-16 Thread Matching Socks
Cider could be most *helpful* by linking all words that could possibly be 
linked.  Everyone uses clojure.core, after all.

Cider could be most *elegant* by not attempting these links at all. 

Cider could be most *Emacs-like *by letting users override the symbol 
detector with an Elisp function.  (Then someone could come along with a 
plug-in to automate the selection of a Codox algorithm, a clojure.core 
strategy, etc., for each namespace.)

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


Reflection warning: {} argument can’t be resolved as java.util.Map

2016-05-16 Thread 676c7473
Hello,

I am getting a reflection warning in Java interop and don’t understand
why:

(import 'java.time.format.DateTimeFormatterBuilder
'java.time.temporal.ChronoField)

(set! *warn-on-reflection* true)

(let [builder (DateTimeFormatterBuilder.)]
  (.appendText builder ChronoField/YEAR {}))
; Reflection warning, ... - call to method appendText on 
java.time.format.DateTimeFormatterBuilder can't be resolved (argument 
types: java.time.temporal.ChronoField, clojure.lang.IPersistentMap).

The method expects a java.util.Map, which {} implements, so this should
resolve without problem. I have tried adding a type hint but it has no
effect:

(let [builder (DateTimeFormatterBuilder.)]
  (.appendText builder ChronoField/YEAR ^java.util.Map {}))

What is the best way to type-hint this properly?

Thank you,


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


Re: Clojure docstring style

2016-05-16 Thread Phillip Lord


The problem is that the var might not be a var yet. You'd have to
re-render code after evaluation.

Phil

Christopher Small  writes:

> Seems like this shouldn't be a problem as long as you only try to render a 
> link if there's actually such a var. This might be a little messier, but 
> would make things (overall) nicer (I think) because you wouldn't have to 
> think about a separate bit of syntax. The rendering would just happen 
> differently depending on whether or not there was something to link to. I 
> already do markdown in most of my docstrings anyway, and I'd prefer not 
> having to rewrite a bunch of docstrings to take advantage of such a 
> feature; I'm sure there are others with me as well :-)
>
> This arguably violates least-surprise / separation of concerns, but in my 
> opinion not so significantly that the costs outweigh the benefits (again, 
> as long as you only tried to link if you knew it was a var).
>
> My 2 cents...
>
> Chris
>
>
> On Sunday, May 15, 2016 at 2:03:02 PM UTC-7, James Reeves wrote:
>>
>> If the docstrings are written in markdown, this would conflict as 
>> something in backticks isn't necessarily a var name.
>>
>> In Codox, I used the wiki-link style: [[clojure.core/map]].
>>
>> - James
>>
>> On 15 May 2016 at 18:40, cskksc > wrote:
>>
>>> Hello,
>>> We are working on a new feature in CIDER which would parse a docstring 
>>> and create hyperlinks that follow the functions/vars/interop-forms 
>>> mentioned there.
>>> It is very similar to the "See Also" links shown by ClojureDocs 
>>> . Right now, we are using backticks to identify 
>>> the reference forms and create links.
>>>
>>> So a function like;
>>>
>>> (defn test-mde
>>>   "Does something with `user-ns/user-fn`.
>>>Also see: `clojure.core/map`, `clojure.core/reduce`, `defn`"
>>>   []
>>>   (+ 1 1))
>>>
>>> would create hyperlinks for map, reduce, defn and user-ns/user-fn forms.
>>>
>>> What style do you tend to use in such docstrings ?
>>> It would help us figure out whether to continue with the backticks or do 
>>> something else, like adding a configuration variable for this.
>>>

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


Access user created Java package from Clojure

2016-05-16 Thread Michael Rice
I'm working through "Clojure for the Brave and True." Right now I'm focused 
on Java interop, in particular creating a simple Java package and accessing 
it from Clojure. My applicable directory structure is listed below along 
with some code, examples of it executing, and my classpath.

For starters, two questions:

1) Is it possible to run PirateConversation from Clojure, and if so, how?

2) If I move my pirate_phrases directory from phrasebook directory to my 
HOME directory (on my classpath), how do I change the import statement in 
PirateConversation.java to access it for compilation?

Michael

--  

Home
  phrasebook
pirate_phrases
  Greetings.class
  Farewells.class
PirateConversation.class

PirateConversation.java:

import pirate_phrases.*;

public class PirateConversation
{
  public static void main(String[] args)
  {
Greetings greetings = new Greetings();
greetings.hello();

Farewells farewells = new Farewells();
farewells.goodbye();
  }
}

[mrice@localhost phrasebook]$ java PirateConversation
Shiver me timbers!!!
A fair turn of the tide for ye thar, ye magnificent sea friend!!
[mrice@localhost phrasebook]$
[mrice@localhost phrasebook]$ cd
[mrice@localhost ~]$ java PirateConversation
Shiver me timbers!!!
A fair turn of the tide for ye thar, ye magnificent sea friend!!
[mrice@localhost ~]$ echo $CLASSPATH
.:/home/mrice/myclasses:/home/mrice/phrasebook


-- 
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: Reflection warning: {} argument can’t be resolved as java.util.Map

2016-05-16 Thread Alex Miller
This is kind of an interesting case. From poking at it a bit, the {} is 
typed as a IPersistentMap, and IPM does NOT extend java.util.Map (although 
the implementations like PersistentArrayMap and PersistentHashMap do via 
APersistentMap).

I think the interesting question is why the type hint is not taking effect 
as you would expect that to work. That could be because {} is a constant 
empty map. That needs some more investigation and if you wanted to file a 
jira ticket, we could do so further.

One workaround to get you going for now is:

  (let [builder (DateTimeFormatterBuilder.)] 
(.appendText builder ChronoField/YEAR ^java.util.Map (array-map)))




On Monday, May 16, 2016 at 7:15:35 AM UTC-5, 676c7...@gmail.com wrote:
>
> Hello,
>
> I am getting a reflection warning in Java interop and don’t understand
> why:
>
> (import 'java.time.format.DateTimeFormatterBuilder
> 'java.time.temporal.ChronoField)
>
> (set! *warn-on-reflection* true)
>
> (let [builder (DateTimeFormatterBuilder.)]
>   (.appendText builder ChronoField/YEAR {}))
> ; Reflection warning, ... - call to method appendText on 
> java.time.format.DateTimeFormatterBuilder can't be resolved (argument 
> types: java.time.temporal.ChronoField, clojure.lang.IPersistentMap).
>
> The method expects a java.util.Map, which {} implements, so this should
> resolve without problem. I have tried adding a type hint but it has no
> effect:
>
> (let [builder (DateTimeFormatterBuilder.)]
>   (.appendText builder ChronoField/YEAR ^java.util.Map {}))
>
> What is the best way to type-hint this properly?
>
> Thank you,
>
>
> -- 
> 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/d/optout.


Re: Reflection warning: {} argument can’t be resolved as java.util.Map

2016-05-16 Thread Nicola Mometto
On 16 May 2016, at 15:53, Alex Miller  wrote:
> 
> This is kind of an interesting case. From poking at it a bit, the {} is typed 
> as a IPersistentMap, and IPM does NOT extend java.util.Map (although the 
> implementations like PersistentArrayMap and PersistentHashMap do via 
> APersistentMap).
> 
> I think the interesting question is why the type hint is not taking effect as 
> you would expect that to work. That could be because {} is a constant empty 
> map. That needs some more investigation and if you wanted to file a jira 
> ticket, we could do so further.

It's because you can't (currently) override type hints on constant collections, 
see:

https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L1950-L1960
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L2962-L2972

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


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Reflection warning: {} argument can’t be resolved as java.util.Map

2016-05-16 Thread Nicola Mometto
Actually s/constant/literal/
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L3003-L3005
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L3057-L3060
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L3143-L3145
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L3218-L3220


> It's because you can't (currently) override type hints on constant 
> collections, see:
> 
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L1950-L1960
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L2962-L2972

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


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Reflection warning: {} argument can’t be resolved as java.util.Map

2016-05-16 Thread 676c7473
Another observation: it seems that the type inference stumbles only when
there is an overloaded method with the same arity (?):

(import 'java.time.format.TextStyle)

(let [builder (DateTimeFormatterBuilder.)]
  (.appendZoneText builder TextStyle/FULL #{}))

This is a similar case in the same API with java.util.Set instead of
Map. Here no type hints are necessary, apparently because there is only
one arity-2 overload for this method and #{} can be resolved as
java.util.Set without warnings.

I will file a JIRA for this.

Thank you,


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


Re: Reflection warning: {} argument can’t be resolved as java.util.Map

2016-05-16 Thread 676c7473
I have opened http://dev.clojure.org/jira/browse/CLJ-1929.

-- 
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: Reflection warning: {} argument can’t be resolved as java.util.Map

2016-05-16 Thread Alex Miller
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: :default catch blocks with core.async and clojurescript

2016-05-16 Thread Kevin Downey
On 05/15/2016 06:39 PM, Kevin Downey wrote:
> On 05/14/2016 09:31 PM, cameron wrote:
>> I'm having an issue where :default catch blocks are not working in
>> clojurescript when in a go block.
>>
>> The following code prints "a str" as expected:
>>
>> (prn (try
>>(throw "a str")
>>(catch :default e e )))
>>
>> The same code in a go block results in an unhandled exception 
>> (go (prn (try
>> (throw "a str")
>> (catch :default e e 
>>
>> I can see an old core.async issue that added support for :default
>> (http://dev.clojure.org/jira/browse/ASYNC-42) 
>> but no other references, is this a regression or something I'm missing?
>>
>> I'm using clojurescript  "1.8.51"  and core.async "0.2.374"
>>
>> Cameron.
>>
>> -- 
>> 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 will likely find that (throw (js/String. "a str")) will work the
> same in both.
> 
> This issue has two parts:
> 
> 1. String literals are somehow not objects or something in javascript (I
> don't entirely understand this, but I vaguely recall that it is a thing)
> 
> 2. The go macro uses js/Object as the exception type in the "catch all"
> exception handler it creates to emulate exception handling.
> 
> You can verify that the combination of these two things causes this
> problem by playing with this code:
> 
> (try (throw "foo") (catch js/Object e :good))
> 
> (try (throw (js/String. "foo")) (catch js/Object e :good))
> 
> (try (throw "foo") (catch :default e :good))
> 
> The "Fix" for the issue you linked didn't change "js/Object" to
> ":default" in the catch all, so it didn't actually fix anything.
> 

I am not entirely sure what to do with this. What I did was re-open
async-42 with a link to this thread

-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

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


Validation of prismatic schema

2016-05-16 Thread Peeyush Jain
Hello everyone,
  I am very new to clojure programming. I have a 
problem with my schema validation and i have asked the question on 
stackoverflow. link: http://stackoverflow.com/q/37263775/3639192 . I know 
it is a very basic question but i have been trying to solve it for a long 
time. Any help would be appreciated. 

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.