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
  • 17,289
  • 56
  • 182
  • 325
  • 1
    clojure.org provide a page that explains and give names to each wired. So it should be easier to google about it. https://clojure.org/guides/weird_characters – souenzzo Jul 03 '21 at 15:27

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,121
  • 1
  • 3
  • 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,562
  • 3
  • 47
  • 64