That was quick, thanks.

One Question for vector matches, I was thinking of a 'case-ex macro which 
basically copies the semantics of erlangs case-expressions.

eg.

(case-ex (db/find-object some-id)
  [:ok object] object
  [:error :not-found] default-object)

expands to

(match [(db/find-object some-id)]
  [[:ok object]] object
  [[:error :not-found]] default-object)

I loved case-ex in Erlang, not convinced its a good way to go in lisp-y 
land but I miss them so I'm gonna try. Anyways, right now the result of the 
function has to satisfy 'vector?, would it hurt any "specs" to test for 
clojure.lang.Indexed/cljs.core.IIndexed?

I was thinking of combining case-ex with (tuple :ok object) instead of [:ok 
object] as return values, but I haven't done any actual benchmarks if 
special Tuple2,3,4 (then normal vector) classes would be useful 
performance/memory-wise. Well, time will tell. Just an idea I had floating 
around.


Cheers,
/thomas

On Monday, June 24, 2013 6:01:37 PM UTC+2, David Nolen wrote:
>
> Thanks for the report, fixed and 0.2.0-rc2 is going out.
>
> Probably going to hold off on ex-info change, the behavior of match is the 
> same as `case` with respect to the no match exception.
>
> David
>
>
> On Mon, Jun 24, 2013 at 11:10 AM, Thomas Heller 
> <th.h...@gmail.com<javascript:>
> > wrote:
>
>> Hey David,
>>
>> I wanted to try core.match for a while and fiddled around a bit to see 
>> what kind of code is generated by match, in doing so I found a potentially 
>> "dangerous" bug.
>>
>> See: https://gist.github.com/thheller/5850693#file-match-clj-L67
>>
>> If a match has no :else clause an IllegalArgumentException is thrown and 
>> (do-something) is called AGAIN instead of using the top-level let result. 
>> This might cause problems in some apps. Also why not throw (ex-info 
>> "bad-match in line <xyz> of <file.clj>" {:result value}).
>>
>> I always wanted to try erlang style case-expressions in clojure and apart 
>> from this bug core.match just might finally make me do some serious testing.
>>
>> Cheers,
>> /thomas
>>
>>
>> On Monday, June 24, 2013 4:15:56 PM UTC+2, David Nolen wrote:
>>
>>> I've written up how core.match works here http://github.com/**
>>> clojure/core.match/wiki/**Understanding-the-algorithm<http://github.com/clojure/core.match/wiki/Understanding-the-algorithm>
>>>
>>> Hopefully this is a bit more approachable than the Maranget paper :)
>>>
>>>
>>> On Mon, Jun 24, 2013 at 7:43 AM, David Nolen <dnolen...@gmail.com>wrote:
>>>
>>>> core.match 0.2.0-rc1 going out the door. ClojureScript support now up 
>>>> to date with Clojure. I've also changed the ClojureScript version to 
>>>> optimize for performance over code size as the code size issues are less 
>>>> problematic for ClojureScript than they are for the JVM.
>>>>
>>>> http://github.com/clojure/**core.match/blob/master/**CHANGES.md<http://github.com/clojure/core.match/blob/master/CHANGES.md>
>>>>
>>>> Please give it a try!
>>>>
>>>> David
>>>>
>>>
>>>  -- 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "ClojureScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojurescrip...@googlegroups.com <javascript:>.
>> To post to this group, send email to clojur...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/clojurescript.
>>  
>>  
>>
>
>

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


Reply via email to