If you look at this example:
(defn wtv [in] (if (= 0 in) 0 10))
(s/fdef wtv
:args (s/cat :in int?)
:ret (s/and int? #(not= 0 %)))
(s/exercise-fn `wtv)
(s/conform `wtv (wtv 0))
You'll see that exercise gives you most of the time the following sample:
[(0) 0]
But this fails to co
>
> multi-spec doesn't require you to use a key of a map - it's an arbitrary
> function on arbitrary data, so it could leverage satisfies? or other
> protocol functionality.
>
Oh, that's good to know, but I'm talking other way around. Where I can
dispatch based on what the spec is for a given
| Also interesting, clojure's print methods will handle some escapes, but not
others
I think that's just that \t is printed as \t. Like a tab shows up as \t.
Whereas say a Unicode like \u1234 will show the character of it. You can seek
that here:
(print (pr-str "foo\u0009bar"))
"foo\t
multi-spec doesn't require you to use a key of a map - it's an arbitrary
function on arbitrary data, so it could leverage satisfies? or other protocol
functionality.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email t
| I don't understand what this one is.
I think I might be wishing specs were also types. In my head, I see as say, if
I spec a vector as ::cart-items, I'd like to implement a protocol for
::cart-items which will dispatch to the function handling ::cart-items, and if
that didn't exist, it would
A funny hole in the meta-programming story. I don't think the String or
Character classes have methods that do this.
Also interesting, clojure's print methods will handle some escapes, but not
others:
cavm.core=> (println (pr-str "foo\tbar"))
"foo\tbar"
nil
cavm.core=> (println (pr-str "foo\
Clojure leans on Java to read that literal. There is no Clojure function to
forcibly print it that way again, but you can probably use the Java methods on
String or Character to get the String representation of a character somehow.
--
You received this message because you are subscribed to the
Is there an easy way to display a string as a string literal that can be
read by clojure?
E.g.
> (let [x "\001"] (what-goes-here x))
"\001"
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.co
On Tuesday, March 28, 2017 at 11:52:11 AM UTC-5, Didier wrote:
>
> I was wondering if protocols do or will be extended to support specs?
I think that's undetermined at this point.
> I'm thinking in the two following ways:
>
> 1) I can spec a protocol's functions so that whoever implements it