Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-02 Thread James Reeves
On 2 September 2017 at 05:06, Rostislav Svoboda wrote: > > identity isn't a boolean, so neither true? nor false? should return true > for it > > But then why it should return 'false'? Because you're asking, "Is identity the boolean value true?", and Clojure is

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-02 Thread Colin Yates
A more revealing name for 'true?' and 'false?' would be 'boolean-which-equals-true?' and 'boolean-which-equals-false?'. Since the 'identity' function isn't a boolean both functions return 'false', and '(= false false)' is 'true'. '(true? (true? identity) (false? identity))' would return, you

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-02 Thread Rostislav Svoboda
Aaaah! :) My math books say booleans can't be true and false in the same time. I made a mistake assuming that the identity function just because it exists somewhere as an object in the memory is of a boolean type and as such it's boolean value is true. Well, everybody here - thank you! Just for

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Didier
What might confuse you, is why Clojure even have true? and false? functions? Its because conditional constructs like if, cond, when, test for truthy (aka logical true) and falsey (aka logical false), not true and false. Nil and False are falsey, and everything else is truthy. Most of the time

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Ravindra Jaju
(= 1 10) => false (= 2 10) => false (= 10 10) => true (= false false) => true (= (= 1 10) (= 2 10)) => true class BoolTest { public static void main(String args[]) { System.out.println(Boolean.TRUE.equals(System.class) == Boolean.FALSE.equals(System.class)); // prints "true",

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Andy Fingerhut
By design, true? never throws an exception. Neither does false? You can create functions similar to those that throw an exception when given a non-boolean value, if you want such functions. (Note: examples below rely on existence of clojure.core/boolean? which does not exist in Clojure 1.8.0)

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Timothy Baldridge
Think about what you're asking: "Hey, is identity a boolean true value?" "No, it is a function, not a boolean" "Is, identity a boolean false value?" "No, it's a function, not a boolean" Makes plenty sense to me. On Fri, Sep 1, 2017 at 10:06 PM, Rostislav Svoboda <

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Rostislav Svoboda
> identity isn't a boolean, so neither true? nor false? should return true for > it But then why it should return 'false'? 2017-09-02 6:04 GMT+02:00 Justin Smith : > identity isn't a boolean, so neither true? nor false? should return true for > it > > > On Fri, Sep 1, 2017

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Rostislav Svoboda
> You seem to be confused about what true? and false? are intended to do. No no, it's not me who's confused about booleans. It's the computer :) 2017-09-02 5:59 GMT+02:00 Justin Smith : > You seem to be confused about what true? and false? are intended to do. > > +user=>

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Justin Smith
identity isn't a boolean, so neither true? nor false? should return true for it On Fri, Sep 1, 2017 at 9:01 PM Rostislav Svoboda < rostislav.svob...@gmail.com> wrote: > > (true? identity) -> false > > (false? identity) -> false > > (= false false) -> true > > Well: > (= identity identity) ->

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Rostislav Svoboda
> (true? identity) -> false > (false? identity) -> false > (= false false) -> true Well: (= identity identity) -> true My math books say booleans can't be true and false in the same time. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Justin Smith
You seem to be confused about what true? and false? are intended to do. +user=> (doc true?) - clojure.core/true? ([x]) Returns true if x is the value true, false otherwise. nil +user=> (doc false?) - clojure.core/false? ([x]) Returns true if x

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Rostislav Svoboda
> This is what I would expect - the identity function is neither the value > true, or the value false Hmm. No matter what's the value of the identity, the functions 'true?', 'false?', 'not' should then return an exception (or something else) instead of a boolean. 2017-09-02 5:49 GMT+02:00 Mark

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Mark Engelberg
(true? identity) -> false (false? identity) -> false (= false false) -> true On Fri, Sep 1, 2017 at 8:43 PM, Rostislav Svoboda < rostislav.svob...@gmail.com> wrote: > Hi, can anybody explain it please? > > $ java -cp clojure-1.8.0.jar clojure.main > Clojure 1.8.0 > user=> (= (true? identity)

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Justin Smith
This is what I would expect - the identity function is neither the value true, or the value false On Fri, Sep 1, 2017 at 8:44 PM Rostislav Svoboda < rostislav.svob...@gmail.com> wrote: > Hi, can anybody explain it please? > > $ java -cp clojure-1.8.0.jar clojure.main > Clojure 1.8.0 > user=> (=

SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Rostislav Svoboda
Hi, can anybody explain it please? $ java -cp clojure-1.8.0.jar clojure.main Clojure 1.8.0 user=> (= (true? identity) (false? identity)) true And in 1.9.0-alpha19 it behaves the same. thx Bost -- You received this message because you are subscribed to the Google Groups "Clojure" group. To