« first day (3532 days earlier)      last day (248 days later) » 

 
3 hours later…
7:18 AM
@HostileForksaysdonttrustSE Having it the same makes it hard for people to understand why they cannot do certain things, and finding out that the match has progressed the advance point and there is no way to now use what was before. Like in a view parse it would be nice to parse from keyword (button return label etc) to keyword and use the stuff in between as specification for the previous item.
(View is not the best example here to use this kind of solution)
 
 
2 hours later…
8:57 AM
List on Rebol Parse Project: The Trello
Purpose: Syntactic conditional pattern matching without dynamic rules. Importance: Increases the expressiveness of the PARSE dialect to match that of the Generalized TDPL. Together with FAIL it ...
✍ 1 comment
> "Note: The word => has been suggested instead of THEN for this operation, but would require a REBOL syntax exception. THEN was accepted with that name, not as =>."
 
 
2 hours later…
10:47 AM
@HostileForksaysdonttrustSE So, need a new keyword for the proposed feature, or a new keyword to replace existing THEN?
 
@Edoc I've never used this THEN. I don't immediately grasp the difference between [rule1 (cont: rule2) | (cont: rule3)] cont and [rule1 rule2 | rule3].
If rule1 failed, wouldn't it just go to the next alternate anyway... and if it succeeded, wouldn't it run the next rule anyway?
Assuming this has a point...it probably does...I'd say name it out of the way.
 
@Edoc This THEN is used within the context of 'parse dialect. So no need to redefine any other THEN I guess...
 
We need a "read and voidify" operation, a sort of "this variable will self destruct". For cases when you switch on a thing, but know that the state you just read must be updated because it loses its meaning in the switch. Maybe that's what a VOIDIFY operation could be useful for, by returning the old value.
var: 1 | switch voidify 'var [1 [... but var is void now ...] ...]
 
 
5 hours later…
3:37 PM
@HostileForksaysdonttrustSE The difference is when rule1 succeeds and rule2 fails. The left example will not try rule3 but the right example will.
 
3:51 PM
@MarkI parse "ac" ["a" "b" | "ac"] works, and parse "ac" ["a" then "b" | "c"] does not, nor does parse "ac" ["a" then "b" | "ac"]. The examples for these things need to be better than throwing in some idiom like "[end skip]" which looks nonsensical to those who don't know it (Ren-C just uses FALSE).
 
4:17 PM
@HostileForksaysdonttrustSE I like your examples a lot better too.
 
 
1 hour later…
5:33 PM
@rgchris Vague wondering-out-loud... I wonder if multiple return values might help in control constructs, where you have a separate potential output parameter for whether the branch was taken. If you don't ask for it, you get voidification. If you do ask for it, you don't?
Or maybe "processed result, unprocessed result" and you could just say you don't want the processed result. [_ unprocessed]: case [true [null]] setting unprocessed to null.
 
5:45 PM
Eh. I think the GET-BLOCK! answer is looking the most promising for full-band branches. They may "break" the convention of letting NULL signal "no branch ran". The meaning just evolves to "either no branch ran, or a GET-BLOCK! branch ran that returned NULL".
 
6:02 PM
    n-generator: func [body [block!]] [
        let g: generator compose [
            yield: enclose 'yield func [f] [
                f/value: quote :f/value
                return dequote do f
            ]
            (as group! body)
        ]
        return func [] [dequote g]
    ]

    a: b: c: void

    g: n-generator [
        a: yield 1
        b: yield null
        c: yield 2
    ]

    did all [
        g = 1
        g = null
        g = 2
        g = null
        g = null

        a = 1
^-- that is killer, and it works. YIELD by default does not let you give back nulls (reserved as the signal that a generator is finished). In spite of the system not wanting to let you, that works around it... though your generator is now not "official" and you know you're probably doing something bad. Still, an amazing test.
It tweaks the YIELD function in order to make it yield a quoted value, then a wrapping function dequotes it to return to the caller, then when the yield picks back up it dequotes to effectively give back the null as if that's what the system yield had yielded... so the YIELD still appears to return the same result it took in.
 
 
2 hours later…
7:40 PM
Note: That should be UNQUOTE (which takes one quote level off), not DEQUOTE (which takes all quote levels off)
 
 
2 hours later…
9:51 PM
collect [
    while generator [
        yield 1
        yield 2
        yield 3
    ] func [x] [
        keep x * 10
    ]
]
== [10 20 30]
collect [
    while generator [
        yield 1
        yield 2
        yield 3
    ] x => [  ; lambda syntax, shorthand for FUNC
        keep x * 10
    ]
]
== [10 20 30]
This really makes me want predicates, because I feel like the conditional truth isn't the thing you want to be testing but you want to be testing for non-nullness with generators. while .value? generator [...] x => [...] Still uneasy as I think while /value? looks more "bold" in proportion with the effects, but .xxx can look like an option too.
 

« first day (3532 days earlier)      last day (248 days later) »