Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a string list in Clojure?

Tags:

clojure

I want to create a string list in Clojure equivalent to the following Java code:

List<String> cities = Arrays.asList(new String[] {"Berlin", "Brussels", "Helsinki", "Madrid", "Oslo", "Paris","Stockholm" });

: but I am unsure about the exact syntax

like image 589
yazz.com Avatar asked Feb 22 '11 17:02

yazz.com


1 Answers

Strictly speaking, examples provided above will produce vectors. List can be produced in the following way:

(list "Berlin", "Brussels", "Helsinki", "Madrid", "Oslo", "Paris","Stockholm")

or shorter:

'("Berlin", "Brussels", "Helsinki", "Madrid", "Oslo", "Paris","Stockholm")

In some cases this difference could be important.

like image 120
aav Avatar answered Sep 21 '22 13:09

aav