REBOL3 tracker
  0.9.12 beta
Ticket #0002149 User: anonymous

Project:

Previous Next
rss
TypeWish Statusreviewed Date10-May-2014 22:54
Versionr3 master CategoryNative Submitted byGraham
PlatformAll Severityminor Prioritynormal

Summary Add a /last refinement to REMOVE to remove the last element in a series
Description at present we have the following ways to remove last

The common idiom is:

head remove back tail series

We also have

take/last series series

We should have

remove/last series to be equivalent to the idiom
Example code

			

Assigned ton/a Fixed in- Last Update22-Jun-2014 00:39


Comments
(0004424)
Gregg
12-May-2014 19:36

For orthogonality, yes. Seems I've always stuck with my old mezz's that I had before TAKE/LAST. :\

Not crucial, but useful in that it's easy to find.
(0004443)
fork
16-Jun-2014 08:09

It has come up on StackOverflow and @draegtun has asked for it:

http://stackoverflow.com/questions/18231434

...and posted a Gist about it:

https://gist.github.com/draegtun/6243869

Seems like a good idea to me to add it to the action! in the C code.
(0004453)
BrianH
22-Jun-2014 00:39

Agreed, except it the return value shouldn't be the head of the series (for REMOVE of a series), it should be the series at the position passed to REMOVE. This would be consistent with the existing behavior of REMOVE and allow better chaining. Otherwise that position is lost.

Be sure to add the /last option at the end, so we don't break any port schemes - remember that REMOVE isn't mezzanine, it's an action, and ports accept that action. This might break port schemes that don't have /last defined if we don't pass it along properly, at least when REMOVE/last is used on them. What this means conceptually for ports, or even whether this applies, would depend on the scheme.

Remember to make it work with /part as well, both the position and the number arguments. With the bitset! type this may be equivalent to removing the last bit.

The combination of /part and /last on a bitset! type is problematic, so we should ignore one or the other unless we can think of a logical way to combine them. Needs debate.

Date User Field Action Change
22-Jun-2014 00:48 BrianH Comment : 0004453 Modified -
22-Jun-2014 00:39 BrianH Comment : 0004453 Added -
22-Jun-2014 00:29 BrianH Summary Modified Add a last refinement to remove to remove the last element in a series => Add a /last refinement to REMOVE to remove the last element in a series
22-Jun-2014 00:29 BrianH Description Modified -
22-Jun-2014 00:29 BrianH Category Modified Mezzanine => Native
22-Jun-2014 00:29 BrianH Status Modified submitted => reviewed
16-Jun-2014 08:09 fork Comment : 0004443 Added -
12-May-2014 19:36 Gregg Comment : 0004424 Added -
10-May-2014 22:54 Graham Ticket Added -