Copy / part with a pair in REBOL 3
help copy
matters copy
:
USAGE:
COPY value /part length /deep /types kinds
DESCRIPTION:
Copies a series, object, or other value.
COPY is an action value.
ARGUMENTS:
value -- At position (series! port! map! object! bitset! any-function!)
REFINEMENTS:
/part -- Limits to a given length or position
length (number! series! pair!)
/deep -- Also copies series values within the block
/types -- What datatypes to copy
kinds (typeset! datatype!)
Refinement /part
can be number!
, series!
or pair!
. I was unable to get it to pair!
work. (I haven't tried it yet series!
.) Is this not implemented? If so, how does it work?
+3
source to share
1 answer
Improvement / part! works with images. The pair refers to x / y coordinates as in
>> img: load %image.png
== make image! [519x391 #{
1D2F9F1D2F9F1C2E9E1C2E9E1B2D9D1B2D9D1B2D9D1B2D9D1D2F9F1C2E9E
1A2C9C192B9B192B9B1A2C9C1B2D9D1C2E9E1D2EA01...
>> copy/part img 2x2
== make image! [2x2 #{
1D2F9F1D2F9F1D2F9F1D2F9F
}]
And here's an example of how / part series works !
>> s: [a b c d e f g]
== [a b c d e f g]
>> ser: skip s 3
== [d e f g]
>> copy/part s ser
== [a b c]
+2
source to share