Wow, David, that's a nice little demonstration of cl-format. I hadn't
seen that before.

But as Mike points out, clojure.contrib.strint/<< is more precisely
what the poster is asking for: true ruby-style string interpolation.

It has occurred to me to extend cl-format to do real string
interpolation (it would be nice to have both in-line arguments and
format control), but it has never gotten to the top of my list.

Tom

On Nov 20, 3:22 pm, David Sletten <da...@bosatsu.net> wrote:
> The cool way is to use Tom Faulhaber's cl-format in 
> clojure.pprint:http://clojure.github.com/clojure/#clojure.pprint
>
> (use '[clojure.contrib.pprint :only (cl-format)])
> (cl-format true "This is a ~A string.~%" 'funky)
> This is a funky string.
>
> I have a mini-tutorial plus links 
> here:http://www.gettingclojure.com/cookbook:sequences#commas
>
> Have all good days,
> David Sletten
>
> On Nov 20, 2010, at 6:00 PM, HiHeelHottie wrote:
>
>
>
> > I think ruby has nice string interpolation.  You can put the following
> > in a textfield that a user can modify
>
> > This is a #{adjective} string.
>
> > Then, you can take that string, put it in quotes and have ruby
> > evaluate it as a string.  What is the clojure way of doing something
> > similar.  Presenting something like
>
> > "This is a " adjective " string"
>
> > and then wrapping that in (str ) before evaluating it in clojure seems
> > less attractive.
>
> > --
> > 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 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

Reply via email to