REIFY and DEGRADE: a Narrower META and UNMETA

In the "small improvements can be big" category, I think that I've settled on the name for the function that turns quasiforms into antiforms, but leaves everything else alone: DEGRADE...and its complement REIFY which turns antiforms into quasiforms (but leaves everything else alone).

>> first [1020 ~null~]
== 1020

>> second [1020 ~null~]
== ~null~

>> degrade first [1020 ~null~]
== 1020

>> degrade second [1020 ~null~]
== ~null~  ; anti

>> 304
== 304

>> reify 304
== 304

>> true
== ~true~  ; anti

>> reify true
== ~true~

If you're dealing with a full-band situation where you genuinely don't know if you're working with a "meaningful quasiform" where quasi means quasi, you have to use META and UNMETA. But if you know that quasiforms aren't part of your data of interest, REIFY and DEGRADE can help you dodge adding and removing quote marks much (or most) of the time.

I like how DEGRADE can be used in situations like this to help you strike the quotes on the normal values...since SIGIL OF never returns quasiforms, only SIGIL! or a null antiform:

for-each [sigil items] [
    ~null~ [  word   tu.p.le   pa/th   [bl o ck]   (gr o up)  ]
    ::     [  word:  tu.p.le:  pa/th:  [bl o ck]:  (gr o up): ]
    :      [ :word  :tu.p.le  :pa/th  :[bl o ck]  :(gr o up)  ]
    ^      [ ^word  ^tu.p.le  ^pa/th  ^[bl o ck]  ^(gr o up)  ]
    &      [ &word  &tu.p.le  &pa/th  &[bl o ck]  &(gr o up)  ]
    @      [ @word  @tu.p.le  @pa/th  @[bl o ck]  @(gr o up)  ]
    $      [ $word  $tu.p.le  $pa/th  $[bl o ck]  $(gr o up)  ]
][
    for-each item items [
        if (degrade sigil) <> sigil of item [
            fail [mold item]
        ]
    ]
]

I think this will be a useful and common pattern.

Void being a word antiform is locking this all up into place!

:atom_symbol: :+1:

1 Like

I guess I should have an answer to the question of why I didn't pair REIFY with UNREIFY.

Uh, maybe it should be called that?

The rationale in my head was something like:

  • "oh, it's not always UNREIFY-ing, it leaves non-quasi things in their plain forms". But it's not "always degrading" either.

  • UNREIFY doesn't scan well as a word (but UNMETA does?)

There's an implicit meaning here where it's "REIFY-ANTIFORMS" and "UNREIFY-QUASIFORMS". Something about REIFY only applying to antiforms makes clear intuitive sense (you don't need to reify a WORD!, it's already reified). But you could imagine UNREIFY-ing a WORD! and getting an antiform word. So the "-QUASIFORMS" is not as obvious.

I'm not 100% confident that the benefit of choosing a word besides UNREIFY is worth breaking the pairing, but DEGRADE is less off-putting in the source. So it's what I went with.