Mailinglist Archive: yast-devel (116 mails)

< Previous Next >
Re: [yast-devel] new YCP builtins
  • From: Lukas Ocilka <lukas.ocilka@xxxxxxx>
  • Date: Wed, 04 Jun 2008 16:04:15 +0200
  • Message-id: <4846A0DF.8030708@xxxxxxx>
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 the
predicate function says so. Returns a list of lists.


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.


< Previous Next >
Follow Ups