Rebol Programming/first+

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

USAGE:[edit | edit source]

FIRST+ 'word 

DESCRIPTION:[edit | edit source]

Return FIRST of series, and increment the series index.

FIRST+ is a function value.

ARGUMENTS[edit | edit source]

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

(SPECIAL ATTRIBUTES)[edit | edit source]

  • catch

SOURCE CODE[edit | edit source]

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]
]