If you want to serialize the data to EDN and back, and print them out into the EDN file as (keyword "arbitrary-char-sequence"), then using the normal Clojure functions for reading the EDN data in will leave those expressions as the lists (keyword "arbitrary-char-sequence"). Of course you could write a simple function that walks the data structure looking for such lists and replacing them with the corresponding keywords. However, that breaks round-tripability of the data if you ever have an occurrence of such a list in your original data before printing it to EDN. If you believe, or can somehow ensure, that will never happen, seems workable to me.
Using a custom data-reader like #my.namespace/keyword "arbitrary-char-sequence" with a globally unique namespace that you own would be less susceptible to such aliasing problems. Andy On Wed, Aug 8, 2018 at 4:55 PM Didier <didi...@gmail.com> wrote: > Reviving an old thread. I have a case where I convert ION to Clojure, and > ION has a SYMBOL type, which can be any UTF-8 character, including spaces. > I though of making them keywords in Clojure, since they serve the same > purpose, to be used as identifiers. I can create such keyword with the > keyword function, but they don't serialize to EDN and back using the > default printer and reader. > > I'm thinking of extending the printer like tbc++ says so keywords are > printed as (keyword "string") instead. Does anyone believe there is > something that's going to bite me later if I do this? > > On Tuesday, 13 March 2012 00:14:48 UTC-7, Andy Fingerhut wrote: >> >> Ah, my senior moment was not noticing the invalid example use of symbol >> in the second example, which was passing strings of decimal digits to >> symbol. I went ahead and deleted that one. >> >> Thanks, >> Andy >> >> On Mar 13, 2012, at 12:04 AM, Andy Fingerhut wrote: >> >> Which one? >> >> (symbol 'foo) >> >> (symbol "foo") >> >> (symbol "clojure.core" "foo") >> >> I don't see it, but I'm probably having a senior moment. >> >> clojuredocs.org are editable to anyone willing to create a free account, >> by the way. I'm nobody special there. >> >> Andy >> >> On Mar 12, 2012, at 11:53 PM, Meikel Brandmeyer (kotarak) wrote: >> >> Hi, >> >> Am Dienstag, 13. März 2012 07:46:58 UTC+1 schrieb Andy Fingerhut: >>> >>> >>> http://clojuredocs.org/clojure_core/clojure.core/symbol >>> >>> >> And right below is an example of invalid usage. >> >> Sincerely >> Meikel >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@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+u...@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 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. > -- 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.