tag:blogger.com,1999:blog-2780729680834099800.post6014617061983480357..comments2013-11-22T16:10:03.513-05:00Comments on Clojure Yap: Re-formatting variable namesAnonymoushttp://www.blogger.com/profile/13071213731127795604noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-2780729680834099800.post-47678949707494699222011-11-20T17:18:46.966-05:002011-11-20T17:18:46.966-05:00Heh. I have to admit that I didn't know replac...Heh. I have to admit that I didn't know replace could also take a function either, until I checked the docs; I'm still learning too... but this is why blog posts and public discussions are so great - they stimulate this kind of discovery :-)Scott Lowehttps://www.blogger.com/profile/02704840845141975933noreply@blogger.comtag:blogger.com,1999:blog-2780729680834099800.post-76958415287469510842011-11-20T17:09:45.485-05:002011-11-20T17:09:45.485-05:00By the way, this code appears in Salty's find....By the way, this code appears in Salty's <a href="https://github.com/manutter51/salty/blob/master/src/salty/find.clj" rel="nofollow">find.clj</a> file, which has the :require and :use statements needed to make it work. I left some of those details out of the blog post in the interests of minimizing distracting details.Anonymoushttps://www.blogger.com/profile/13071213731127795604noreply@blogger.comtag:blogger.com,1999:blog-2780729680834099800.post-54400404583959835442011-11-20T16:56:46.978-05:002011-11-20T16:56:46.978-05:00Awesome, that's actually the code I wanted to ...Awesome, that's actually the code I wanted to write, but I didn't know you could pass an anonymous function as the third arg to (replace). Thanks!Anonymoushttps://www.blogger.com/profile/13071213731127795604noreply@blogger.comtag:blogger.com,1999:blog-2780729680834099800.post-12502275601298551152011-11-20T16:34:12.905-05:002011-11-20T16:34:12.905-05:00It's great to see Clojure experimentation goin...It's great to see Clojure experimentation going on!<br /><br />How about using a regex pattern match:<br /><br />(require '[clojure.string :as str])<br /><br />(str/replace "camelCase" #"[A-Z]" #(str \- (str/lower-case %)))Scott Lowehttps://www.blogger.com/profile/02704840845141975933noreply@blogger.com