Re: Are keys and vals guaranteed to return in the same order?

2015-04-19 Thread Thumbnail
... For example (let [m1 (array-map 1 2, 3 4) m2 (array-map 3 4, 1 2)] [(= m1 m2) (= (seq m1) (seq m2))]) => [true false] -- 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

Re: Are keys and vals guaranteed to return in the same order?

2015-04-19 Thread Thumbnail
*Is order guaranteed?* For any map m, (= m (zipmap (keys m) (vals m))) ... is guaranteed. But, for two maps m1 and m2, (= m1 m2) ... does *not* imply (= (seq m1) (seq m2)) *Which version to prefer?* It's worth looking at what the Clojure Cookbook does

Re: regex

2014-04-18 Thread Thumbnail
Of course! Thank you. On Friday, 18 April 2014 15:33:39 UTC+1, A. Webb wrote: > > > > On Friday, April 18, 2014 8:28:03 AM UTC-5, Thumbnail wrote: >> >> >> ... I decided that the terminal state would always be at index 0 ... >>> >> >> Sh

Re: regex

2014-04-18 Thread Thumbnail
> I had a couple of insights. First, to allow the dfa to be generated > programmatically, I changed it from a map to a vector. This means > that the next state can just be an integer. Second, I decided that > the terminal state would always be at index 0 ... > Shouldn't a DFA allow for *a

Re: find first match in a sequence

2013-05-19 Thread Thumbnail
... or just (comp first filter) ((comp first filter) odd? [2 4 6 7 8 9]) => 7 -- -- 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 - ple

((symbol "whatever") 1 :a) evaluates to :a . How can this be?

2012-03-15 Thread Thumbnail
An expression yielding an arbitrary symbol, used as a function, returns its second argument. ((symbol "whatever") 1 :a) => :a If it has one argument, it returns nil. ((symbol "whatever") 1) => nil It does not accept more than two arguments. ((symbol "whatever") 1 :a \z) => # And it does not a