Rebol 编程/move
外观
< Rebol 编程
MOVE source offset /part length /skip size /to
在系列中移动值或值的跨度。
MOVE 是一个函数值。
- 源 -- 源系列(类型:系列)
- 偏移 -- 移动的偏移量,或移动到的索引(类型:整数)
- /part -- 移动系列的一部分
- 长度 -- 要移动的部分的长度(类型:整数)
- /skip -- 将系列视为固定大小的记录
- 大小 -- 每个记录的大小(类型:整数)
- /to -- 移动到相对于系列头的索引
- 捕捉
move: func [
"Move a value or span of values in a series."
[catch]
source [series!] "Source series"
offset [integer!] "Offset to move by, or index to move to"
/part "Move part of a series"
length [integer!] "The length of the part to move"
/skip "Treat the series as records of fixed size"
size [integer!] "Size of each record"
/to {Move to an index relative to the head of the series}
][
unless length [length: 1]
if skip [
if 1 > size [throw-error 'script 'out-of-range size]
offset: either to [offset - 1 * size + 1] [offset * size]
length: length * size
]
part: copy/part source length
remove/part source length
insert either to [at head source offset] [
system/words/skip source offset
] part
]