Comments on: 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:
size: xy + 100x200
offset: parent / 2
text: join base specific
Then you want to do something like:
a-spec: make map! spec
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
text: "App Prefs"
I have practically never needed to reduce a set-word inside a block, so this is a deeply welcome feature. Thanks. :-)|
Very interesting to generate VID scripts at run time. Very good idea.|
I think I use compose in those cases....|
My problem with COMPOSE in such cases is, as soon as you calculate something with parens it's a bit cumbersome to get done right.|
Should the /only refinement be renamed if this refinement is added?
/only left for backwards compat but marked deprecated?|
It'd be nice if this were default behaviour of reduce, with reduce/all as the all-powerful override. Yes, it'd not be compatible, but in this case merited on the benefits to the language?|
This gives the smarter programmer dynamic (run-time) data setting.
Post a Comment:
You can post a comment here. Keep it on-topic.