Writing in raw X-expressions

20 views
Skip to first unread message

Daniel Sockwell

unread,
Apr 6, 2019, 7:00:40 PM4/6/19
to poll...@googlegroups.com
I just discovered Pollen and am very much enjoying reading the docs/am excited to dive in.

I have a quick question: is it possible to use Pollen to write x-expressions directly? That is, can I directly write

'(root "I want to attend " (em "RacketCon " (strong "this") " year") ".")

instead of

#lang pollen
I want to attend ◊em{RacketCon ◊strong{this} year}.

I realize that I might be partly missing the point—this is almost asking if I can use Pollen without using Pollen. However, there are a number of times when the direct x-expression seems like it would be clearer (at least for my site). That is, there are a number of times that I would rather put text in my code than code in my text. Does Pollen allow me to do so?

Thanks in advance!
Daniel



Matthew Butterick

unread,
Apr 6, 2019, 8:45:50 PM4/6/19
to Daniel Sockwell, poll...@googlegroups.com

On Apr 6, 2019, at 4:00 PM, Daniel Sockwell <dan...@codesections.com> wrote:

I have a quick question: is it possible to use Pollen to write x-expressions directly? That is, can I directly write

   '(root "I want to attend " (em "RacketCon " (strong "this") " year") ".")

instead of

   #lang pollen
   I want to attend ◊em{RacketCon ◊strong{this} year}.


Yes, you can insert Racket-style expressions instead of Pollen-style expressions. [1]

The `root` wrapper is always added by Pollen, but you can use the splicing operator `@` to accomplish the same thing. Therefore this:

#lang pollen/markup
◊(@ "I want to attend " (em "RacketCon " (strong "this") " year") ".")

is the same as this:

#lang pollen/markup
I want to attend ◊em{RacketCon ◊strong{this} year}.

Or mix the styles:

#lang pollen/markup

◊(@ "I want to attend " (em "RacketCon " (strong "this") " year") ".")
I want to attend ◊em{RacketCon ◊strong{this} year}.


Reply all
Reply to author
Forward
0 new messages