Hallo, Chris McCormick hat gesagt: // Chris McCormick wrote:
I'd like to second the suggestions of these additions to Pd. I think the important features to add would be those that can't currently be simulated with abstrations and other builtins. For example, [s2l] which as discussed works like Perl's split() function. Negative indicies could be simulated with the help of [mod] if only there was a [list length] as suggested by Frank. The drip style serialization which you suggest above could also be simulated easily with [until] and [list length] and [list split].
So basically I'd like to see a [list length] and an [s2l].
You can do "list length" with a simple counter and "list split" already. It's called [list-len] in [list]-abs. However unfolding a list using [until] and [list split] is very slow. I did benchmarks comparing it to [drip] and it takes ages longer. As a "drip" operation is used so often - Matju once compared it to the "for"-loop of other languages - it is important that "drip" is fast, and not only fast, but very fast. I'd much prefer to have a fast unfolding operation over getting "list length".
And negative indices are just very convenient, and the object is already in.
I don't think that [s2l] should become part of [list]. To me it is a typical string operation, like Perl's split and string.split() in Python.
Ciao