0

I have the following output in one of my tests:

Assertion failed:
Expected :[[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] ["seq07"] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []]
Actual   :[() () () () () () () () () () () () () () () () () () () () () () () () () () ("seq07") () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () ()]

What do () and ("seq07") mean in this output?

Glory to Russia
  • 15,153
  • 48
  • 169
  • 304

2 Answers2

3

As noted in another answer, () is an empty list and [] is an empty vector.

Note however that = compares the contents of lists and vectors, it ignores the type of the container:

(= '("seq07") ["seq07"])           ;; => true
(= '(()) [[]])                     ;; => true

The assertion failure in the question is due to the actual vector having fewer elements than the expected vector:

(= ['("seq07")] ['("seq07") '()])  ;; => false
Steffan Westcott
  • 2,016
  • 1
  • 2
  • 13
1

() is a notation for list whereas [] is a notation for vectors

() is an empty list and ("seq07") is a list that contains a single member - the string seq07

you can read more about clojure lists here

EDIT: just found this interesting SO question about lists vs vectors

Erez Rabih
  • 15,080
  • 3
  • 42
  • 62