On Aug 1, 2016, at 12:43 PM, Chris Forster <[email protected]> wrote:
> 
> (txexpr 'div '((id "top")) '("Hello" (p "World"))) 
> 
> I'm not sure I understand why the nested paragraph wouldn't also be a 
> txexper--would there ever be a situation where the following would make sense?
> 
> (txexpr 'div '((id "top")) '("Hello" (txexpr 'p empty "World")))
> 

True, the second expression will test as a `txexpr?`, but notice that it's not 
giving the result you expect:

'(div ((id "top")) "Hello" (txexpr 'p empty "World")) ; wrong!

Because '("Hello" (txexpr 'p empty "World")) is prefixed with a quote, 
everything inside gets quoted, including the `txexpr`. Instead, you could do 
this:

(txexpr 'div '((id "top")) `("Hello" ,(txexpr 'p empty '("World"))))

Now, this expression will have the same result as:

(txexpr 'div '((id "top")) '("Hello" (p "World"))) 


> 
> Likewise, if I follow, does that mean that there is no situation where a 
> txexper can't be replaced by a quasiquoted expression?

Right. A txexpr is just a Racket list, with some special conditions about what 
values can appear where. In general, you can use any of Racket's list-making / 
list-breaking functions to make a txexpr. Quasiquoting is just a way of making 
a list. The advantage of the `txexpr` function itself is that it will check 
your arguments to make sure they will result in a valid txexpr. Sometimes 
that's helpful. Sometimes not.

In the `pollen-tfl` docs I show some examples of how different Racket functions 
can make valid txexprs:

http://docs.racket-lang.org/pollen-tfl/_pollen_rkt_.html#%28part._.Making_tagged_.X-expressions__txexprs_%29

-- 
You received this message because you are subscribed to the Google Groups 
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to