The R3C Branch ("Chris's Rebol" or "Rebol 3 Conservative")

Hopefully you're warming up a bit to the generalized paths and tuples, and how they can be COMPOSE'd with pieces spliced, etc. I mentioned there was a long way to go on mechanics, but progress has proceeded one hard-won fight at a time...

Example: Tonight while firming up the idea that BLANK! is matched literally in PARSE for arrays, I found it instantly applicable to a significant step ahead in processing refinement-y things:

>> refinement-rule: [subparse path! [_ word!]]

>> parse [/foo] [refinement-rule]
== foo

SUBPARSE is basically like "INTO AHEAD", so it parses into the rule product of its first argument. (The first rule doesn't have to be a pattern on the input series, it could be a GROUP! that synthesizes any arbitrary series or sequence.)

So recall that:

>> as block! /foo
== [_ foo]

Also, that BLOCK! rules evaluate to the last matched thing.

NewPath has come, and seen, and is now conquering. :crossed_swords: What about composing paths where a slash before an array spreads it out?

>> parse 'a/[b c]/d//[e f] [collect some [keep [spread [_ any-array!] | <any>]]]
== [a [b c] d e f]

When you see /foo and foo/ fitting into this general mechanism it makes it worth figuring out how to negotiate their new nature.

1 Like