Re: [ANN] Clojure 1.9.0-alpha6

2017-01-03 Thread mattias w
*Please make stest/instrument check :ret too, not only :args.* I have been experimenting a lot with spec during December, and I really like it. On the downside, the syntax is very verbose, compared to prismatic schema. However, reuse is much simpler than for schemas. I disagree with this

Destructing lists using -> Difference between '(:opt1 true) and [:opt1 true]

2017-01-02 Thread mattias w
Could someone explain why the first doesn't work and the 2nd does? (let [{:keys [opt1]} [:opt1 true]] [opt1]) ==> [nil] (let [{:keys [opt1]} '(:opt1 true)] [opt1]) ==> [true] According to http://clojure.org/guides/destructuring "Associative destructuring also works with lists of key-value

Re: .length vs. count for string length

2016-04-10 Thread mattias w
With clojure 1.8, we got many of these functions, but not str/length and str/substring. What am I missing? /mattias Den fredag 1 november 2013 kl. 19:40:42 UTC+1 skrev Sean Corfield: > > This thread made me run a quick audit of our code and we had about a > dozen calls to .length, a dozen

Why do map/get and similar return nil if not found?

2016-01-12 Thread mattias w
Clojure and Erlang are very similar, except for the syntax, macros and that you can use Java libraries. There is one big difference: In Erlang, fail as early as possible is the norm. In Clojure it is almost the opposite. Many errors in Clojure code will result in nil, and most operations

Re: Define new defn, lein uberjar succeeds to compile but lein run fails

2015-11-25 Thread mattias w
I moved my own definition of defn to a separate project, and then it works. It seems you cannot redefine defn within the same project it is used. Den fredag 13 november 2015 kl. 13:46:56 UTC+1 skrev mattias w: > > I defined my own defn in the namespace mwm. > > > My new

Define new defn, lein uberjar succeeds to compile but lein run fails

2015-11-13 Thread mattias w
I defined my own defn in the namespace mwm. My new code looks like this (mwm/defn foo [x] ...) Everything was fine as long as it was called defn2, but after renaming it to defn and refering to the original defn using clojure.core/defn, only "lein uberjar" works. When I run "lein run",