-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename SPLIT's /INTO refinement #2051
Comments
Submitted by: fork As evidenced by the above comments in the example code, /INTO would be a troublesome name that could apply to both scenarios... A name that seems to only apply to the "/INTO" case could be /EVENLY..., although it would have to be explained as "Split into N equally-sized parts as best possible (with at most one non-empty piece of an unequal size to the others)" >> split/evenly [a b c d e f] 2
== [[a b c] [d e f]] >> split/evenly [a b c d e f] 7
== [[a] [b] [c] [d] [e] [f] []] >> split/evenly [a b c d e f] 4
== [[a] [b] [c] [d e f]] |
Submitted by: rgchris Is it certain that |
Submitted by: fork +1 for the switch and calling the old default behavior split/skip (as proposed by @onetom) The current default skipping behavior is pretty Rebol specific. "I split the rope in two" means something in English, and it does not mean you split the rope in many pieces of size 2 split/length has the problem as with /into... are you splitting with the intent of producing a result which will have that length? Or are you splitting into pieces which have that length? It's ambiguous. /skip is unambiguous, has precedent, and not contentious with English usage. |
Submitted by: BrianH I agree with changing the default, but how about calling the new option /by instead? This would be more helpful when you do multi-level splitting, where the value you're splitting by would be an array compatible dimensions block, rather than a select compatible record size. |
Submitted by: Gregg +1 for the switch and calling the old default behavior split/skip. Brian, I think it will do what you want without /BY, because of how block args are processed. Or I'm misunderstanding. |
Sorry.. I used
|
Now one could make a wish to add |
I think the argument would be that you're always splitting the series into pieces. So this can come off a bit like saying split/split. /INTO is clearly a bad name. And with years under the bridge from this being last discussed, I now think that the Rebol interpretation of /SKIP would come across as the current "default" behavior, to just skip 2 each time. Which makes it seem less good for this refinement. One thing I noticed is that Red does not have this refinement, suggesting possibly it was not considered that important. No use cases really come to mind. I may rather drop it and wait for it to be explicitly requested, at which time the name can be reconsidered. |
Submitted by: abolka
SPLIT currently has an /INTO refinement, that toggles between splitting into parts of length N and splitting into N parts (cf. the example code).
While aptly named in and of itself, this non-standard usage of /INTO conflicts with the intention to use
/INTO outbuffer
as a common refinement to pre-supply a result buffer to functions (to avoid allocating intermediate storage). This latter usage is currently implemented in e.g. AJOIN, COLLECT, COMPOSE, EXTRACT, REDUCE, or REWORD.So SPLIT's /INTO refinement should be renamed, to avoid conflict with the standard /INTO usage.
CC - Data [ Version: r3 master Type: Wish Platform: All Category: Mezzanine Reproduce: Always Fixed-in:none ]
The text was updated successfully, but these errors were encountered: