Re: Lazy binding

2009-09-03 Thread ngocdaothanh
Compojure's default view syntax looks great (same idea as Yaw's EHTML: http://yaws.hyber.org/dynamic.yaws). It allows one to "stay in Clojure". I found an example of integrating StringTemplate (and Hibernate) with Clojure: http://bitbucket.org/kumarshantanu/blogjure/ Is there more example of int

Re: Lazy binding

2009-09-03 Thread James Sofra
Not to distract from the talk on how to achieve these things in Clojure but I really want to second Stuart's recommendation of StringTemplate, it really is a great library and is seamless to use from Clojure. I would recommend it for any templating needs, not just HTML views, in fact I have used

Re: Lazy binding

2009-09-03 Thread ngocdaothanh
Using a map of keywords is a good solution, but I think it is somewhat just boilerplate code to satisfy the compiler, not to satisfy developers (yes, human). In view we have to write (:my-var map) everywhere. Is there a better way, something like lazy variable binding or lazy function binding? To

Re: Lazy binding

2009-09-03 Thread tmountain
I believe the way this works in rails has to do with the order in which variables are resolved. In this case, @name is an instance variable that's already been assigned elsewhere (your controller). Rails loads the view after the controller class has been instantiated. For this to work, the view is

Re: Lazy binding

2009-09-03 Thread Stuart Sierra
Check out www.stringtemplate.org, a Java template library with a functional design. -SS On Sep 3, 8:42 am, ngocdaothanh wrote: > Hi, > > In Rails you can create a view like this: > > my_view.erb: > <%= "hello" + @name %> > > I'm new to Clojure. I want to create something like the above like > t

Re: Lazy binding

2009-09-03 Thread Jarkko Oranen
Oops, accidentally sent the post before it was ready. Oh, well... --~--~-~--~~~---~--~~ 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

Re: Lazy binding

2009-09-03 Thread Jarkko Oranen
On Sep 3, 3:42 pm, ngocdaothanh wrote: > Hi, > > In Rails you can create a view like this: > > my_view.erb: > <%= "hello" + @name %> > > I'm new to Clojure. I want to create something like the above like > this: > > (defn my-view [] >   (str "hello" name)) > > The point is: > * name is not known