• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the name of a variable as a string

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to pass a variable to a macro, and concatenate its name to a string. For example, something like (str "tag-" variable). I have several struct-map (e.g. s1, s2) and I'd like to make a string based on the name of the struct-map (e.g "tag-s1", "tag-s2"). Is there a way to do it ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Variables have some implicit metadata placed on them. One of those is ":name" :
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic