What is fundamental difference for having a ‘?’ in every? and not in some functions of clojure?
user> (every? true? [true true false])
false
user> (some true? [true false false])
true
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
every?returns true or false, so it gets a question mark.somedoesn’t return a boolean, it returns “the first logically true value returned by pred”, and returnsnilotherwise.Here’s the lame example I came up with:
The first element in the collection gets passed into the predicate, the predicate evaluates to 0, which is logically true so
somereturns 0. you can seesomeis not returning true or false.So
every?gets a question mark because it returns true or false.somereturns the value returned bypredor nil, so it doesn’t get a question mark.