REBOL 3.0

REDUCE/no-set

Carl Sassenrath, CTO
REBOL Technologies
30-Aug-2007 4:08 GMT

Article #0101
Main page || Index || Prior Article [0100] || Next Article [0102] || 7 Comments || Send feedback

Here is a frequent pattern: you have a block of set-words and value expressions. You want to reduce the expressions, but leave the set-words as is.

For example, you might have:

spec: [ 
    size: xy + 100x200
    offset: parent / 2
    text: join base specific
]

Then you want to do something like:

a-spec: make map! spec

or perhaps:

a-gob: make gob! spec

But, that is a problem, because you cannot easily reduce the block without the set-words getting set.

Fortunately, along comes REDUCE/no-set. This refinement to REDUCE prevents the set operation for set-words within the block.

Using it on the spec block above, you would see something like:

>> probe reduce/no-set spec
== [
    size: 240x480
    offset: 100x200
    text: "App Prefs"
]

7 Comments

REBOL 3.0
Updated 9-Dec-2017 - Edit - Copyright REBOL Technologies - REBOL.net