Anton said:

AR> and NEW-LINE bugs me more, where you have to wrap the
AR> thing you're modifying in a sandwhich of 2 arguments.

Yeah, you're never going to get it things right for everybody; and
I've thought, too, that NEW-LINE doesn't read particularly well,
so...what do you think of something like this (watch for wrap):

new-lines: func [
    input [block!]
    /local
        set clear insert remove other ords keys
        =ord =state =all =skip =block
][
    insert: set:   on
    remove: clear: off
    other: 2
    ords: [first second third fourth fifth sixth seventh eigth ninth tenth]
    keys: append copy ords [in from every all marker markers item items]
    input: reduce/only bind/copy input 'ords keys

    =ord: =state: =all: =skip: none
    ord=: [
        set =ord ['first | 'second | 'third | 'fourth | 'fifth
                 | 'sixth | 'seventh | 'eigth | 'ninth | 'tenth]
        (=skip: index? find ords =ord)
    ]

    rule=: [
        any [
            'all (=all: true)
            | [set =state logic!]
            | ['every [set =skip integer! | ord=]]
            | [opt ['in | 'from] set =block block!]
            | ['marker | 'markers | 'item | 'items]
          ] (
            if all [=block  not none? =state] [
                either =skip [new-line/skip =block =state =skip] [
                    either =all [new-line/all =block =state] [
                        new-line =block =state
                    ]
                ]
            ]
          )

    ]
    either parse input rule= [=block] [none]
]

Examples:
        b: [1 2 3 4 5]
        new-lines [all on in b]
        new-lines [all off in b]
        new-lines [every other on in b]
        new-lines [every other in b off ]
        new-lines [in b every third item on]
        new-lines [in b off every 3]
        new-lines [insert marker in b every 2 items]
        new-lines [remove marker in b every 3 items]
        new-lines [set all markers in b]
        new-lines [clear all markers in b]
        new-lines [set every other marker in b]
        new-lines [clear marker every other item in b]
        new-lines [b all off]
        new-lines [b on]
        new-lines [b off]


--Gregg

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to