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
SET+
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