Generate character sequence from 'a' to 'z' in clojure

后端 未结 4 1458
夕颜
夕颜 2021-01-01 20:28

I want to generate character sequence from \'a\' to \'z\'. In scala, I can generate character sequence very simply:

(\'a\' to \'z\')

But in

4条回答
  •  遥遥无期
    2021-01-01 21:23

    AFAIK, no such a fancy way as Scala. How about

    (flatten (partition 1 "abcdefghijklmnopqrstuvwxyz"))
    

    Edit

    More fancy way, thanks to @rhu

    (seq "abcdefghijklmnopqrstuvwxyz") ; if you copied this from an earlier version, \w and \v were in the wrong positions
    

提交回复
热议问题