Clojure

In latest clojure, empty list is neither true nor false

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: Backlog
  • Component/s: None
  • Labels:
    None

Description

In latest Clojure, compiled today:

user> (true? ())
false
user> (false? ())
false

This makes empty collections the only entities in Clojure which are neither true, nor false.
I'm fairly sure () used to be true – is this an intentional change? Googling reveals lots of warnings about the empty list not being false in Clojure.

Activity

Hide
Assembla Importer added a comment -
Show
Assembla Importer added a comment - Converted from http://www.assembla.com/spaces/clojure/tickets/414
Hide
Assembla Importer added a comment -

bpsm said: You've confused true? and false? with boolean.

Clojure 1.0.1-alpha-SNAPSHOT
user=> (false? '())
false
user=> (true? '())
false
user=> (boolean '())
true
</code></pre>
<pre><code>Clojure 1.1.0
user=> (false? '())
false
user=> (true? '())
false
user=> (boolean '())
true
</code></pre>
<pre><code>Clojure 1.2.0-beta1
user=> (false? '())
false
user=> (true? '())
false
user=> (boolean '())
true

boolean converts its argument to either true or false. nil and false yield false, everything else yields true.
true? and false? do no such conversion, nor should they. Only true is true?. Only false is false?.

Show
Assembla Importer added a comment - bpsm said: You've confused true? and false? with boolean.
Clojure 1.0.1-alpha-SNAPSHOT
user=> (false? '())
false
user=> (true? '())
false
user=> (boolean '())
true
</code></pre>
<pre><code>Clojure 1.1.0
user=> (false? '())
false
user=> (true? '())
false
user=> (boolean '())
true
</code></pre>
<pre><code>Clojure 1.2.0-beta1
user=> (false? '())
false
user=> (true? '())
false
user=> (boolean '())
true
boolean converts its argument to either true or false. nil and false yield false, everything else yields true. true? and false? do no such conversion, nor should they. Only true is true?. Only false is false?.

People

  • Assignee:
    Unassigned
    Reporter:
    Anonymous
Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: