Haskell can do this:
['a'..'z']
Have Clojure easy expression like Haskell?
There isn't a straightforward equivalent to Haskell's syntax, but there are several alternatives, to mention a few:
(map char (range (int \a) (inc (int \z))))
(seq "abcdefghijklmnopqrstuwvxyz")
Either way, the result will be:
(\a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z)
If it doesn't exist, you could always write it.
(defn letter-range [start end]
(map char (range (int (.charAt start 0))
(inc (int (.charAt end 0))))))
(letter-range "a" "z")
=> (\a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z)
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