[REBOL] Re: Core 2.6 - Last minute requests - take your chance!
From: robbo1mark:aol at: 5-Apr-2002 8:54
Here's my wish list for REBOL/Core 2.6 and contains
lot's of useful additional series! functions which are
swap, top, pop, push, rest, drop, chop, nip, tuck, cut,
slice and chomp.
I've also included quote which is useful and a new and
better license 8-).
Here's the sources;
quote: func [
"Returns the literal value of it's argument."
'val [any-type!]
][
:val
]
license: func [
"Prints the NEW REBOL/core license agreement."
][
print system/license: read http://www.gnu.org/licenses/gpl.txt
]
swap: func [
"Reverses the first two elements in a series."
series [series!]
][
reverse/part series 2
]
top: func [
"Returns the first element of a series."
series [series!]
][
first series
]
pop: func [
"Returns and removes the first element of a series."
series [series!]
/local temp
][
temp: first series remove series temp
]
push: func [
"Inserts a value at the first element of a series."
series [series!]
val [any-type!]
][
insert series val
]
rest: func [
"Returns the remainder of series excluding the first element."
series [series!]
][
at series 2
]
drop: func [
"Removes the first element of a series."
series [series!]
][
remove series
]
chop: func [
"Removes the last element of a series."
series [series!]
][
remove at tail series -1
]
nip: func [
"Removes the second element of a series."
series [series!]
][
remove at series 2
]
tuck: func [
"Inserts a value at the first element of a series."
series [series!]
val [any-type!]
][
insert at series 2 val
]
cut: func [
"Splits a series into constituent parts ^/ at the specified index postion."
series [series!]
index [integer!]
/local val1 val2
][
reduce [ val1: copy/part series index val2: at series (index + 1) ]
]
slice: func [
"Returns a part of a series from the specified index."
series [series!]
index [integer!]
size [integer!]
][
copy/part at series index size
]
chomp: func [
"Removes and returns a part of a series from the specified index."
series [series!]
index [integer!]
size [integer!]
/local temp
][
temp: copy/part at series index size
remove/part at series index size
temp
]
REBOL Technologies Inc. have my express permission to use these
any and whichever way they choose.
Cheers,
Mark Dickson