The simple things matter the most

Perhaps this needs to be in a (sub)category of its own.

You know the feeling that you want to do something that looks really simple but how to do this in Rebol/Ren-C

Case:
A. Transforming the content of a block into a string

B. Transforming the content of a string to become a block

First try:
A.

>> blk: [What becomes of a block when turned into a {} value?]
== [What becomes of a block when turned into a "" value?]
>> mold blk
== {[What becomes of a block when turned into a "" value?]}

B.

>> txt: "What becomes of a string when turned into a [] value?"
== {What becomes of a string when turned into a [] value?}
>> to block! txt
== [{What becomes of a string when turned into a [] value?}]

So clearly not what was intended!

After some tinkering:
A.

block-to-text: function [blk [block!]][
    result: copy ""
    spacer: copy ""
    for-each b blk [
        append append result spacer mold b
        spacer: copy " "
    ]
    result
]
block-to-text blk
== {What becomes of a block when turned into a "" value?}

B.

>> blk: load append append "[" txt "]"       
== [What becomes of a string when turned into a [] value?]

To be improved?

The naming may not be the best, but you are looking for, respectively, FORM and LOAD:

‌>> form [a b c]
== "a b c"

‌>> load "a b c"
== [a b c]

Not entirely true

>> form [note what [] happens]
== "note what  happens"
>> form [note what [really] happens]
== "note what really happens"

If you have strong feelings about what the natural intent of TO is, that's something that needs to be pinned down, and it's getting closer I think:

Right, this might be what you would want or expect, but if you expect that all in quotes is transformed into a block! then this trivial task is becoming a little more difficult.

This was more meant as a home for those tasks that newcomers would be easy peasy straightforward and that proofed to be a little more tricky in Rebol/Ren-C. To hand some neat tricks and functions and oneliners discuss other solutions wrt speed and readability and alike.

I agree on the TO matrix to be well defined and it needs work for sure, all things can use more of that always :wink:

Or:

>> mold/only [note what [] happens]
== "note what [] happens"

Just occurred to me—this is the opposite of /ONLY usage elsewhere. If my suggestion for replacing /ONLY were in play, it would work the opposite here:

>> mold [note what [] happens]
== "[note what [] happens]"
‌
‌>> mold only [note what [] happens]
== "[[note what [] happens]]"

that would be

>> mold [note what [] happens]
== "note what [] happens"

>> mold only [note what [] happens]
== "[note what [] happens]"

Which implies that BLOCK! is special when it comes to MOLD, which would be fine by me.

In the isotopic era, we have an answer... which is to say that if you mold a SPLICE!, the delimiters are not there!

>> mold [like so]
== "[like so]"

>> mold spread [like so]
== "like so"

Poetically, it solves the exact problem that splices did for APPEND/ONLY and such!

:atom_symbol: