Arvin Schnell wrote:
Hi YCP-Hackers,I've used some ITO time to implement two new YCP builtins: 1. splitlist (var x, list, block using x)Takes a list and a predicate function and splits the list where thepredicate function says so. Returns a list of lists. Example: list<string> l = [ "0", "a", "1", "2", "b", "3", "4" ]; splitlist(string s, l, { return isalpha(s); }); return is [ [ "0" ], [ "a", "1", "2" ], [ "b", "3", "4" ] ] The difference to splitstring is that the 'delimiter' is included in the result since that's the way I need it. If desired I could add a parameter that tells whether the 'delimiter' should be added to the previous list, the following list or not at all.
Hmm, and do you really see any possibility where *else* such a builtin could be used? What are the use-cases? Why should we have it? In my opinion:
* The use-case is very limited, or almost none.
* In conflict with the current /splitstring/ where the delimiter is
not included.
Bye
Lukas
signature.asc
Description: OpenPGP digital signature
