I am going through some Clojure tutorials using Closure Box, and entered the following code:user> (def stooges (vector "Moe" "Larry" "Curly"))#'user/stoogesuser> (contains? stooges "Moe")falseShouldn't this evaluate to TRUE ? Any help is appreciated. 解决方案 A vector is similar to an array. contains? returns true if the key exists in the collection. You should be looking for the "key/index" 0, 1 or 2user=> (def stooges (vector "Moe" "Larry" "Curly"))#'user/stoogesuser=> (contains? stooges 1)trueuser=> (contains? stooges 5)falseIf you were using a hash...user=> (def stooges {:moe "Moe" :larry "Larry" :curly "Curly"})#'user/stoogesuser=> (contains? stooges :moe)trueuser=> (contains? stooges :foo)falseAs mikera suggests, you probably want something like clojure.core/some 这篇关于Clojure“包含"的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-31 01:09