REBOL3 tracker
  0.9.12 beta
Ticket #0002162 User: anonymous

Project:

Previous Next
rss
TypeWish Statussubmitted Date21-Aug-2014 00:40
Versionr3 master CategoryUnspecified Submitted byfork
PlatformAll Severityminor Prioritynormal

Summary Kill REPEND as it has a confusing name and is twice as slow
Description REPEND was already on my list for being an irritating word. In looking at whether it was needed, I ran a test:

http://chat.stackoverflow.com/transcript/message/18394277#18394277

"APPEND X REDUCE Y" or "REDUCE/INTO Y TAIL X" are twice as fast as "REPEND X Y". The reason is that it's a mezzanine, with an APPLY:

repend: make function! [[
{Appends a reduced value to a series and returns the series head.}
series [series! port! map! gob! object! bitset!] "Series at point to insert (modified)"
value "The value to insert"
/part "Limits to a given length or position"
length [number! series! pair!]
/only "Inserts a series as a series"
/dup "Duplicates the insert a specified number of times"
count [number! pair!]
][
apply :append [series reduce :value part length only dup count]
]]

I'll be guessing there are some who would say "oh, it's a great word, I use it all the time, it just needs to be a native".

But it's *not* a great word, and it doesn't need to be a native. If it were so important that anyone would have noticed you would have done something about it being 2x as slow by now! There's no reason to further bless it.

REDUCE/INTO is enough "assembly language" for performance needs if you find a bottleneck and can *honestly* say that bottleneck is coming from doing the reduce-and-then-an-append. "APPEND REDUCE" is good enough for casual users for whom it's not the bottleneck.

And Red's model for optimizations is very different. Being compiled, it should be able to have optimizations that notice when you are statically doing "APPEND REDUCE X Y"... if it weren't exactly that and you were doing "APPEND :FOO X Y" then repend wouldn't have helped you anyway (!)
Example code

			

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


Comments
(0004531)
BrianH
21-Oct-2014 18:28

If we do this, deprecate it first. And be sure to put the existing mezzanine into the old module (#2132).

Date User Field Action Change
21-Oct-2014 18:28 BrianH Comment : 0004531 Added -
21-Aug-2014 00:40 Fork Ticket Added -