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 t
(= 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", System.c
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)
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 <
rostislav.svob...@gmail.c
> 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 at 9:01 PM Rostislav S
> 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=> (doc true?)
> ---
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) -> tru
> (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 th
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 is
> 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 E
(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) (fal
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=> (= (
Due to the new dependence on external jars, these instructions will be
different in Clojure 1.9. We will be providing additional tooling to make this
easier but that's still a work in progress.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post
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 post
Hi, readme.txt says:
To run: java -cp clojure-${VERSION}.jar clojure.main
so I tried it out:
$ java -cp clojure-1.9.0-alpha19.jar clojure.main
Exception in thread "main" java.lang.ExceptionInInitializerError
at clojure.main.(main.java:20)
Caused by: java.io.FileNotFoundException: Could not locat
Introducing Arche (https://github.com/troy-west/arche).
Using Alia (https://github.com/mpenet/alia) as a base, Arche provides the
following:
- Cassandra state management (Cluster / Session / Prepared Statements /
Execution Options / UDTs)
- Optional DI/lifecycle via Integrant
Datomic allows clojure.core fns to be embedded inside datalog queries,
except eval (http://docs.datomic.com/query.html)
1. Do we know how secure is this - what if the datalog comes from untrusted
user input?
2. What is the best way to implement restricted-eval like this on jvm,
compared to on
17 matches
Mail list logo