Sorry for my poor knowledge but what are three and four ways comparison functions ?
mixed compare(mixed a, mixed b) { if(uncomparable_types(a,b)) return CONST_P; if(a<b) return CONST_Q; if(a>b) return CONST_R; if(a==b) return CONST_S; error("uncomparable_types is broken\n"); }
What about ADT.Queue ?
You're right. That's the way to go.
Should we add Array.partition that splits an array into two (like filter with two outputs)?
Do you have an example ?
Array.partition( ({ 1,2,3,4,5,6,7 }), lambda(int x) { return x>3 && !(x%2); });
({ ({ 4,6 }), ({ 1,2,3,5,7 }) })
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?
Array.exists can be done with search, maybe you can add a sort of alias that makes a search. Array.every can be usefull.
No, search can only dermine the equality criterion. Array.exists( arr, `>, 17 )
BTW I think it would be good if more Pike developers could come on IRC more often, there are sometimes newbies on IRC (take Scandium example) and thus it shows IRC is usefull.
But the history function is usually broken in IRC. As is the log. Is there an IRC client in Pike so that at least the client side annoyances can be fixed easily?
/ Martin Nilsson (ja till euro, nej till cent)
Previous text:
2003-09-03 23:53: Subject: Re: Language comparisions
Hello,
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:
Great :)
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?
Sorry for my poor knowledge but what are three and four ways comparison functions ?
Should we make an eval function like most other languages. mixed eval(string x) { return compile_string("mixed foo(){ "+x+";}")()->foo(); }
I don't see the need for it.
Should upper_case and lower_case be able to operate on integers (chars)?
Could be usefull indeed.
Should we add Array.shift and Array.pop to remove elements in either end of the Array?
What about ADT.Queue ?
Should we add Array.partition that splits an array into two (like filter with two outputs)?
Do you have an example ?
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?
Array.exists can be done with search, maybe you can add a sort of alias that makes a search. Array.every can be usefull.
BTW I think it would be good if more Pike developers could come on IRC more often, there are sometimes newbies on IRC (take Scandium example) and thus it shows IRC is usefull.
-- David Gourdelier
/ Brevbäraren