Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Rebol Programming/take

From Wikibooks, open books for an open world
<Rebol Programming
This page may need to bereviewed for quality.

USAGE:

[edit |edit source]
TAKE value /part length /last

DESCRIPTION:

[edit |edit source]

Copies and removes from series. (Modifies)

TAKE is a function value.

ARGUMENTS

[edit |edit source]
  • value -- (Type: series port none)

REFINEMENTS

[edit |edit source]
  • /part -- Limits to a given length or position
    • length -- (Type: number series port pair)
  • /last -- Take it from the tail end

(SPECIAL ATTRIBUTES)

[edit |edit source]
  • catch

SOURCE CODE

[edit |edit source]
take: func [    "Copies and removes from series. (Modifies)"     [catch]     value [series! port! none!]     /part "Limits to a given length or position"     length [number! series! port! pair!]     /last "Take it from the tail end"][    if value [        either part [            case [                pair? length [                    unless image? value [                        throw-error 'script 'invalid-part length                    ]                     last: none                ]                 any [series? length port? length] [                    either same? head value head length [                        length: subtract index? length index? value                    ] [                        throw-error 'script 'invalid-part reduce [length]                    ]                ]            ]             if last [                length: negate length                 value: tail value            ]             also copy/part value length remove/part value length        ] [            also pick either last [                value: back tail value            ] [value] 1 remove value        ]    ]]
Retrieved from "https://en.wikibooks.org/w/index.php?title=Rebol_Programming/take&oldid=3353094"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp