case statement and java constants

2014-02-28 Thread Adam Clements
I'm having some trouble with java constants in a case statement. I know I could use condp, but these are things I could put in a java switch statement and so it's annoying to give up constant time dispatch: (case (.getActionMasked event) MotionEvent/ACTION_POINTER_DOWN :down MotionEvent/ACTI

Re: case statement and java constants

2014-02-28 Thread Ambrose Bonnaire-Sergeant
I'm not 100% sure if this works, but have you tried writing a macro that gets the Java field value, and inserting into the case statement? (defmacro motion-case [...] `(case .. ~MotionEvent/ACTION_POINTER_DOWN ... ~ MotionEvent/ACTION_UP ... )) On Sat, Mar 1, 2014 at 12:15 AM, Adam Clem

Re: case statement and java constants

2014-02-28 Thread Ambrose Bonnaire-Sergeant
IMO that would needlessly complicate an otherwise simple construct, especially since a simple macro can endlessly customise it. Thanks, Ambrose On Sat, Mar 1, 2014 at 12:40 AM, Adam Clements wrote: > That works perfectly, thanks! > > It does feel like it should just work as a normal case statem

Re: case statement and java constants

2014-02-28 Thread Adam Clements
That works perfectly, thanks! It does feel like it should just work as a normal case statement though, where the value is static final, and warn if it isn't. Is there a good reason this shouldn't be supported by the case statement that anyone can think of? Worth filing an enhancement request on cl

Re: case statement and java constants

2014-02-28 Thread Herwig Hochleitner
2014-02-28 17:21 GMT+01:00 Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com>: > (defmacro motion-case [...] > `(case .. > ~MotionEvent/ACTION_POINTER_DOWN ... > ~MotionEvent/ACTION_UP ... > )) > That's a neat trick! Didn't know case could do this. Wouldn't it be great to menti

Re: case statement and java constants

2014-02-28 Thread Andy Fingerhut
Anyone who has a good working example of this can add it to clojuredocs.orgin a few minutes, if they are so inclined: http://clojuredocs.org/clojure_core/clojure.core/case I know that within 5 seconds of reading this one or more people will complain that the site is out of date. It is true t

Re: case statement and java constants

2014-02-28 Thread Alex Miller
I would appreciate a jira enhancement ticket for this. Alex -- 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 fi

Re: case statement and java constants

2014-03-02 Thread Herwig Hochleitner
Created: http://dev.clojure.org/jira/browse/CLJ-1368 2014-03-01 2:58 GMT+01:00 Alex Miller : > I would appreciate a jira enhancement ticket for this. > > Alex > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email

Re: case statement and java constants

2014-03-02 Thread Adam Clements
Oops, I already filed http://dev.clojure.org/jira/browse/CLJ-1367. Should probably link/mark as dupe - I don't appear to be able to do anything other than comment. Adam On Sun, Mar 2, 2014 at 4:35 PM, Herwig Hochleitner wrote: > Created: http://dev.clojure.org/jira/browse/CLJ-1368 > > > 2014-0

Re: case statement and java constants

2014-03-02 Thread Herwig Hochleitner
Oh sorry, I should have looked at the newest issues first. I don't think the tickets are dupes, because yours calls for enabling java static fields for case constants. Mine just wants to add language stating how case can be used right now. IMO enabling case constants is at odds with current doc l