[REBOL] Re: Working with tags
From: tomc:darkwing:uoregon at: 10-Nov-2003 17:30
On Tue, 11 Nov 2003, [iso-8859-1] Ged Byrne wrote:
> I'm just having a little bit of trouble with tags, and
> I can't find what I'm after in the docs.
>
> I'm using the following expressions:
>
> fp: []
> text: "This is text"
> append fp rejoin [<tag> text </tag>]
>
> The result is:
> <tagThis is text</tag>>
>
> I wanted:
> <tag>This is text</tag>
>
> If I try:
> append fp [<tag> text </tag>]
>
> I get:
> <tag> text </tag>
>
> If I try:
> append fp reduce [<tag> text </tag>]
>
> I get:
> <tag> "This is text" </tag>
>
> Which is oh so close, but I don't want them quotes in!
>
> To infuriate me further print [<tag> text </tag>]
> displays the desired results.
>
> Where am I going wrong?
>
> What expression should I be using?
a hackerish solution is
fp: copy []
text: "This is text"
insert tail fp rejoin["" <tag> text </tag>]
but that should only be used till a correct solution is given
join assumes the resulting type is the same as the first type.
when the first type is a tag! it tries to make the whole block a tag
... badly
by putting an empty string first, join just builds a string