How To FIND With A Matcher Function in Ren-C?

I like it, if you can use any function it really shorten things.
But.. how do you search for it? find block word?/ ?

1 Like

Yes, FIND works with antiform frames. As does REPLACE, as it is based on FIND.

>> replace [a 10 b 20] word?/ spread [word found]
== [word found 10 word found 20]

Antiforms have many advantages in terms of cleaning up edge cases, e.g. SPREAD above produces an antiform, curing us of issues pertaining to "/ONLY"

>> replace [[a b] a b a b] [a b] [c d e]
== [[c d e] a b a b] 

>> replace [[a b] a b a b] spread [a b] [c d e]
== [[a b] [c d e] [c d e]]

>> replace [[a b] a b a b] [a b] spread [c d e]
== [c d e a b a b]

>> replace [[a b] a b a b] spread [a b] spread [c d e]
== [[a b] c d e c d e]

NULL is also an antiform, which resolves issues like your question about "what happens when you put a NONE in a block, how do you know if there's a thing there or not as PICK is ambiguous". You can't put null antiforms (or any antiforms) in blocks, so, it's unambiguous.

But here we see another advantage. Antiform frames--which represent the kind of thing that triggers as a function call from word references--can't be in blocks. So if they are passed to something like FIND or REPLACE (or suggested by a trailing slash notation in PARSE) then we know you aren't trying to match an "action in a block", because you can never put actions in blocks... only in their non-antiform states.

Ask if you have questions:

We should start early: could you point to articles about ANTIFORM? to understand what it is?

The article above, "A Justification of Generalized Isotopes", is currently the best explanation I have put together.

If you have questions and want to improve it further--perhaps by putting it into your own words here or explaining where you get lost--then please do.

1 Like