=> *(contains? '(1 2 3) 1)*
IllegalArgumentException contains? not supported on type:
clojure.lang.PersistentList  clojure.lang.RT.contains (RT.java:724)

=> **clojure-version**
{:major 1, :minor 5, :incremental 0, :qualifier "RC17"}


=> *(contains? "foo" "o")*
IllegalArgumentException contains? not supported on type: java.lang.String
clojure.lang.RT.contains (RT.java:724)

=> *(contains? [:a :b :c] :a)*
false

whoops

contains? clojure.core

Argument Lists:
[coll key]

Documentation:
Returns true if key is present in the given collection, otherwise
  returns false.  Note that for numerically indexed collections like
  vectors and Java arrays, this tests if the numeric key is within the
  range of indexes. 'contains?' operates constant or logarithmic
   time;
  it will not perform a linear search for a value.  See also 'some'.

=> (contains? '[:a :b :c] 1)
true
=> (contains? '[:a :b :c] 3)
false
=> (contains? '[:a :b :c] 2)
true

well, I would not have expected that


On Thu, Feb 28, 2013 at 11:14 PM, Irakli Gozalishvili <rfo...@gmail.com>wrote:

>  Hi,
>
> Function 
> contains?<http://clojuredocs.org/clojure_core/clojure.core/contains_q> returns
> true if key is present in the given collection, although arguably on some
> data structures
> one would expect behaviour to be different. In fact it's already different
> on sets:
>
> (contains? #{:a :b :c} :a) ; => true
>
> Would that be reasonable to change behaviour for other types too like:
>
> (contains? [:a :b :c] :a)   ; => false
> (contains? "foo" "o")       ; => false
> (contains? '(1 2 3) 1)       ; => false
>
> So they do return `true` instead ?
>
> If that will break too much code, maybe some other function can be added
> instead ?
>
> Regards
> --
> Irakli Gozalishvili
> Web: http://www.jeditoolkit.com/
>
>  --
> --
> 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.
>
>
>



-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate it.

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