How to use IN with a block instead of an object?

后端 未结 2 507
慢半拍i
慢半拍i 2021-01-14 11:44

The IN function in Rebol finds out if a field is in an object:

USAGE:
    IN object word

DESCRIPTION:
    Returns the word or block in the object\'s context         


        
2条回答
  •  情书的邮戳
    2021-01-14 12:21

    This might not be as useful, but since it is not explicitly mentioned, and I think is the 'right' way to solve your first question for now:

    red>> first find [foo: 10 bar: 20] 'foo
    == foo:
    

    This doesn't work on rebol2 tho, but quoteing the set-word! does :

    >> first find [foo: 10 bar: 20] quote [foo:]
    == foo:
    

    Still has the slight disadvantage of returning a set-word!

提交回复
热议问题