尝试查找索引时处理 'none'? Rebol 中不存在的值?

Handling 'none' when trying to find the index? of a value that doesn't exist in Rebol?

我有一个block!x: ["one" "two" "three"]

index? find x "two" returns...2

index? find x "four" returns...

** Script Error: index? expected series argument of type: series port ** Near: index? find x "twos"

获得索引的最佳方式是什么? return none 而不是错误?

>> help index?
USAGE:
    INDEX? series /xy

DESCRIPTION:
     Returns the index number of the current position in the series.
     INDEX? is an action value.

ARGUMENTS:
     series -- (Type: series port)

REFINEMENTS:
     /xy -- Returns index as an XY pair offset.

索引?期待一个系列。如果参数是 none,则会引发错误。

>>  find x "four"
== none

您可以检查参数是否存在或者是一个系列,或者防止错误,例如

>> if  series? i: find x "four" [index? i]
== none

>> attempt [index? find x "four" none]
== none