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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With