Hi, looks like you could make a word for that, using "slot-named" and "slot"
from the "slots" vocab.Something like:
USING: slots ;
: slot-by-name>> ( object name -- value ) slot-named ! returns a slot-spec
offset>> ! the offset of that slot slot ;
But haven't tried it...
El Viernes, 19 de mayo, 2017 14:07:46, Alexander Ilin <[email protected]>
escribió:
Hello!
Is there a way to generalize this code?
TYPED: maybe-prepend-name ( res: resource-gadget str: string
-- res: resource-gadget str: string added?: boolean )
over res>> name>> [ [ " - " append prepend ] when* ] keep >boolean ;
TYPED: maybe-prepend-root ( res: resource-gadget str: string
-- res: resource-gadget str: string added?: boolean )
over res>> root>> [ [ " - " append prepend ] when* ] keep >boolean ;
The only difference between the two words is in the slot name.
---=====---
Александр
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk