Well, this is of course my favorite subject...
If we want to truly emulate Scala, then I think we'd have
(t/ann ^:no-check conj-vec
(All [x
[y :> x]]
[(t/Vec x) y y * -> (t/Vec y)]))
because you can append a supertype and get back a vector of the supertype.
(t/ann ^:no-check conj-set
(All [x
[y :< x :> x]]
[(t/Set x) y y * -> (t/Set x)]))
because Scala's Set is invariant.
On a more trivial note, why is it better to defn conj-set et al and then
apply conj, rather than just (def conj-set conj)?
On Thursday, November 14, 2013 8:54:22 AM UTC-5, Ambrose Bonnaire-Sergeant
wrote:
>
> Hi,
>
> Announcing a new library which adds Scala-style *static* strictness to
> collection operations.
>
> The first version is a proof-of-concept: please read the contributing
> guidelines <https://github.com/typedclojure/strict-typed-ops#contributing>if
> you want to contribute.
>
> The README <https://github.com/typedclojure/strict-typed-ops> has
> dependency information, an intro and a link to the API.
>
> Enjoy!
> Ambrose
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.