Should we add Array.exists/any to determine if at least one element satisfies a criterion and Array.every/all to determine if the all are?
Sounds useful.
Implemented. I took the liberty of choosing the shorter names. :-)
/ Johan Sundström (utan sälskap)
Previous text:
2003-09-04 01:40: Subject: Language comparisions
Pliant has a four way (</=/>/not comparable) comparision function "compare". Should Pike that instead or at all?
Could perhaps be neat from an ADT standpoint, but for many tasks there are actually very few extra calls if the separate `< and `== are used.
Should we add Array.shift and Array.pop to remove elements in either end of the Array?
If we add the count-from-the-end operator that was discussed a while back (10169402 and comments, subject "Negative ranges revisited") then both can be described both compactly and clearly:
arr = arr[1..]; arr = arr[..$-2];
Much better than names like "shift" and "pop" that one can't be quite sure they would have the intuitively right meaning.
Should we add Array.zip and Array.unzip to merge and split arrays.
I thought Array.interleave_array would do something like this, but now when I look at it I see it does something completely different, and I have no idea what it is.
Should we add Array.exists/any to determine if at least one element satisfies a criterion and Array.every/all to determine if the all are?
Sounds useful.
Should we add the possibility to define default values for types, e.g. typedef int myint = 7;
What do you mean? To me that looks like "constant myint = 7".
/ Martin Stjernholm, Roxen IS