Comments on: APPEND is native

Carl Sassenrath, CTO
REBOL Technologies
21-Aug-2006 0:24 GMT

Article #0038
Main page || Index || Prior Article [0037] || Next Article [0039] || 9 Comments || Send feedback

REBOL 3.0 makes the following change:

 ChangeThe append function is now a native datatype action similar to insert.
 ReasonPerformance is three times greater (and append is a commonly used function), and the /dup and /part refinements are now available (in addition to /only).
 CostActually, the implementation takes less memory now.



Brian Hawley
21-Aug-2006 22:14:57
Well, there's one obscure but common optimization down (insert tail ...). I wonder how many more are yet to come?
Christian Langreiter
22-Aug-2006 14:04:43
Excellent. insert tail ... that was really weird, yeah ;-)
Gregg Irwin
23-Aug-2006 11:49:59
Great! Could the help for /part also be updated to clarify what it does.

  /part -- Limits to a given length or position.
could be:
  /part -- applies range to value; i.e. copy/part value.

I don't use it very often, and sometimes I don't rememeber if the range applies to the overall length of the series or taking /part of the value (it's the latter). I think the reason I get confused is because change/part applies the range to the series, which is different than how insert applies it.

Of course, it makse sense, because you aren't changing part of the series with 'insert, so maybe 'change could use a clearer help string as well.

24-Aug-2006 10:02:24
I second Gregg's suggestion (and support re-assessment of the built-in help in general).
John Niclasen
30-Aug-2006 15:56:53
Thanks a lot! I do "insert tail" a lot.

Is there a handy way to insert one or more steps back from the tail? Like: insert back tail ...

Carl Sassenrath
31-Aug-2006 14:32:09
Gregg: absolutely. A good suggestion.

Edoc: yes. But, as long as the can remain concise. The dictionary is supposed to expand on them, and perhaps in 3.0 we can integrate that feature better.

John: I do too. I've been thinking about better ways to handle tail related semantics. For example, back tail is such a common idiom. We almost need reverse ordinals, but what names to use? First-back, second-back, etc.? A bit wordy too.

Maxim Olivier-Adlhoch
1-Sep-2006 1:32:49
since you are talking about tail semantics... hehe... I was trying to find an R3 topic to talk about this...

could you add 'END to the language as a standard word?

END is different than TAIL in that it would return the series AT its end (last item) instead of beyond it, basically:

  BACK TAIL my-series 
Maxim Olivier-Adlhoch
1-Sep-2006 1:53:02
counting backwards is a standard feature of python and its very well tought out:

adapted to REBOL it could look like:

series/'2  ; '2 is invalid rebol, so could be used

This is very powerfull and replaces something like:

series/(length? series - 1) ; OR
first skip tail series -2
Gregg Irwin
4-Sep-2006 14:32:55
We could combine a couple words for the "back tail" idiom:
at-last: func [series [series!]] [back tail series]

And I'm sure it's possible to just use negative values with path notation and PICK/POKE to refer to tail-relative positions, but does it fit with REBOL's core semantics? If Carl didn't do it, I assume he didn't do it for a reason. And then can you make things consistent with, say, AT?

I've often thought that the way to extend and improve REBOL in some of these cases (some, not all) is to allow block parameters so you can have dialected versions of many functions. I think the series access and modification model can be done a lot of ways with dialects; I've built a few, and I'm sure others have as well.

That said, I think the at-last case is the most common, and supporting it would be good, even if nothing else is done. It also ties in with POP/PULL/TAKE as a common idiom (CHOP - to remove the last item in a series).

Post a Comment:

You can post a comment here. Keep it on-topic.


Blog id:



 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 27-May-2024 - Edit - Copyright REBOL Technologies -