REDUCE/no-set
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
|