REBOL3 tracker
  0.9.12 beta
Ticket #0002174 User: anonymous

Project:

Previous Next
rss
TypeBug Statusreviewed Date28-Sep-2014 19:59
Versionr3 master CategoryNative Submitted byfork
PlatformAll Severityminor Prioritynormal

Summary TAKE does not return the same type of any-block! series being taken from
Description The result of a TAKE/PART is a series, and not a single value.

However, the result of all ANY-BLOCK! TAKEs, regardless of input series, is a BLOCK!. So if you TAKE/PART from a PAREN! for instance, you get a block:

>> take/part quote (1 2 3 4) 2
== [1 2]

The type of the series you are taking from should be preserved, e.g.

>> take/part quote (1 2 3 4) 2
== (1 2)
Example code

			

Assigned ton/a Fixed in- Last Update21-Oct-2014 18:37


Comments
(0004509)
abolka
29-Sep-2014 00:33

Good catch!

Note, TAKE does not coalesce all series into block!s:

>> take/part "foobar" 2
== "fo"

>> take/part #{cafebeef} 2
== #{CAFE}

>> take/part 2
==

It definitely should preserve the actual type for ANY-BLOCK! instances as well, just like e.g. COPY/part does as well:

>> take/part quote (a b c) 2
== [a b] ;; Expected: (a b)

>> take/part quote a/b/c 2
== [a b] ;; Expected: a/b

>> take/part quote 'a/b/c 2
== [a b] ;; Expected: 'a/b

>> take/part quote :a/b/c 2
== [a b] ;; Expected: :a/b

>> take/part quote a/b/c: 2
== [a b] ;; Expected: a/b:

Date User Field Action Change
21-Oct-2014 18:37 BrianH Summary Modified TAKE does not honor series type of series being taken from => TAKE does not return the same type of any-block! series being taken from
21-Oct-2014 18:37 BrianH Category Modified Unspecified => Native
21-Oct-2014 18:37 BrianH Status Modified submitted => reviewed
3-Oct-2014 04:54 Fork Description Modified -
29-Sep-2014 01:02 abolka Comment : 0004509 Modified -
29-Sep-2014 00:48 Fork Type Modified Wish => Bug
29-Sep-2014 00:33 abolka Comment : 0004509 Modified -
29-Sep-2014 00:33 abolka Comment : 0004509 Added -
28-Sep-2014 23:55 Fork Description Modified -
28-Sep-2014 23:55 Fork Severity Modified major => minor
28-Sep-2014 19:59 Fork Ticket Added -