DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

SET+

05.29.2006
| 1735 views |
  • submit to reddit
        
    set+: func [ ; Inspired by Erlang's list model.
        "Like SET, but words block is dialected."
        words  [any-block!] "Word after | gets remainder of series."
        series [series!]
        /local word= rule=
    ][
        word=: [set word word!]
        rule=: [
            any [
                '| word= (set word series) to end
                | word= (
                    set word pick series 1
                    series: next series
                )
            ]
        ]
        parse words rule=
    ]
    ;set+ [a | rest] [1 2 3 4 5]
    ;set+ [a b | rest] [1 2 3 4 5]
    ;set+ [a b c] [1 2]
    

Comments

Snippets Manager replied on Tue, 2006/05/30 - 12:35pm

lagos,Nigeria, calabar, bankpor-irruan, germany, abuja, united state of american, london,catholic, christan, researching, estate.