REBOL Programming/first+

From Wikibooks, open books for an open world
< REBOL Programming
Jump to: navigation, search

USAGE:[edit]

FIRST+ 'word 

DESCRIPTION:[edit]

Return FIRST of series, and increment the series index.

FIRST+ is a function value.

ARGUMENTS[edit]

  • word -- Word must be a series. (Type: word paren)

(SPECIAL ATTRIBUTES)[edit]

  • catch

SOURCE CODE[edit]

first+: func [
    {Return FIRST of series, and increment the series index.} 
    [catch] 
    'word [word! paren!] "Word must be a series."
][
    if paren? :word [set/any 'word do :word] 
    throw-on-error [also pick get word 1 set word next get word]
]