keyword has two arities: (keyword x) will attempt to parse "x" into a keyword with name and namespace parts.
(keyword namespace-part name-part) will make a keyword with name and namespace set explicitly. So to create a keyword dynamically (i.e. not using literal syntax) and be *absolutely sure* namespace is nil, use (keyword nil "something-empty") in your example. Note that the keyword function will happily create keywords whose printed form is either not readable (e.g. include a space, a digit in the wrong place, a bad character, etc) or would be read a different way (include a slash in the name part for e.g.). On Wednesday, March 21, 2018 at 8:15:43 AM UTC-5, Nick Mudge wrote: > > I want to programmatically create some keywords without namespaces? Or > are we not supposed to do that? > > I can't use the "keyword" function because that only creates keywords with > a namespace. > > For example doing this: > (keyword (str "something" "-empty")) > Creates this: > ::something-empty > But I want this: > :something-empty > > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.