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
Previous text:
2003-09-03 16:26: Subject: Language comparisions
I have spent the day adding a Pike column to some more language comparisions on the net, and thought it wise to save some info on where Pike failed:
Python and Perl has a three way (</=/>) comparision function "cmp". Should Pike have one, and where?
Pliant has a four way (</=/>/not comparable) comparision function "compare". Should Pike that instead or at all?
Should we make an eval function like most other languages. mixed eval(string x) { return compile_string("mixed foo(){ "+x+";}")()->foo(); }
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
Should upper_case and lower_case be able to operate on integers (chars)?
Should we add Array.shift and Array.pop to remove elements in either end of the Array?
Should we add Array.zip and Array.unzip to merge and split arrays.
Should we add Array.partition that splits an array into two (like filter with two outputs)?
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?
Should we add the possibility to define default values for types, e.g. typedef int myint = 7;
Do we need a Math.divmod?
Questions, questions...
/ Martin Nilsson (ja till euro, nej till cent)