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...
On Wed, Sep 03, 2003 at 10:30:04AM -0400, Martin Nilsson (ja till euro, nej till cent) @ Pike (-) developers forum wrote:
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.
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
how is that different from this_object() ?
Should we add Array.shift and Array.pop to remove elements in either end of the Array?
if that allows for a destructive change on the array, this would be nice.
Should we add Array.zip and Array.unzip to merge and split arrays.
how does that work? zip and unzip sound rather unintuitive in what they would do.
greetings, martin.
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
how is that different from this_object() ?
It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
Should we add Array.zip and Array.unzip to merge and split arrays.
how does that work?
array a = ({ 1,3,5,7 }); array b = ({ 2,4,6,8 }); Array.zip(a,b); ({1,2,3,4,5,6,7,8});
zip and unzip sound rather unintuitive in what they would do.
No, its a zipper. The name is from Haskell, merd, Python, Scheme and SML, which has the functionality.
/ Martin Nilsson (ja till euro, nej till cent)
Previous text:
2003-09-03 19:26: Subject: Re: Language comparisions
On Wed, Sep 03, 2003 at 10:30:04AM -0400, Martin Nilsson (ja till euro, nej till cent) @ Pike (-) developers forum wrote:
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.
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
how is that different from this_object() ?
Should we add Array.shift and Array.pop to remove elements in either end of the Array?
if that allows for a destructive change on the array, this would be nice.
Should we add Array.zip and Array.unzip to merge and split arrays.
how does that work? zip and unzip sound rather unintuitive in what they would do.
greetings, martin.
/ Brevbäraren
It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
That sounds more like FORTH's "SELF" than Haskell's "id". Haskell's "id" can be defined in Pike as
mixed id(mixed x) { return x; }
array a = ({ 1,3,5,7 }); array b = ({ 2,4,6,8 }); Array.zip(a,b); ({1,2,3,4,5,6,7,8});
To work like in Haskell, it should give ({({1,2}),({3,4}),({5,6}),({7,8})}) The inner things should really be pairs (2-tuples), but since we don't have that...
Prelude> zip [1,3,5,7] [2,4,7,8] [(1,2),(3,4),(5,7),(7,8)] Prelude>
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-09-03 19:36: Subject: Re: Language comparisions
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
how is that different from this_object() ?
It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
Should we add Array.zip and Array.unzip to merge and split arrays.
how does that work?
array a = ({ 1,3,5,7 }); array b = ({ 2,4,6,8 }); Array.zip(a,b); ({1,2,3,4,5,6,7,8});
zip and unzip sound rather unintuitive in what they would do.
No, its a zipper. The name is from Haskell, merd, Python, Scheme and SML, which has the functionality.
/ Martin Nilsson (ja till euro, nej till cent)
Oh, then I misinterpreted the page (or someone misinterpreted Haskell)
/ Martin Nilsson (ja till euro, nej till cent)
Previous text:
2003-09-04 00:24: Subject: Re: Language comparisions
It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
That sounds more like FORTH's "SELF" than Haskell's "id". Haskell's "id" can be defined in Pike as
mixed id(mixed x) { return x; }
array a = ({ 1,3,5,7 }); array b = ({ 2,4,6,8 }); Array.zip(a,b); ({1,2,3,4,5,6,7,8});
To work like in Haskell, it should give ({({1,2}),({3,4}),({5,6}),({7,8})}) The inner things should really be pairs (2-tuples), but since we don't have that...
Prelude> zip [1,3,5,7] [2,4,7,8] [(1,2),(3,4),(5,7),(7,8)] Prelude>
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
By the way, we already have the more generic "zipWith" function, although we call it "sum_arrays":
Array.sum_arrays(aggregate, ({1,3,5,7}), ({2,4,6,8}));
(1) Result: ({ /* 4 elements */ ({ /* 2 elements */ 1, 2 }), ({ /* 2 elements */ 3, 4 }), ({ /* 2 elements */ 5, 6 }), ({ /* 2 elements */ 7, 8 }) })
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-09-04 00:26: Subject: Re: Language comparisions
Oh, then I misinterpreted the page (or someone misinterpreted Haskell)
/ Martin Nilsson (ja till euro, nej till cent)
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
how is that different from this_object() ?
It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
I belive (as in 'don't know for sure') that this_function() would be used to reduce the possibility of function renaming errors when writing recursive functions.
Student code:
// Recursive function that returns !n int oink(int n) { if(n == 0) return 1; else return oink(n-1); }
Teacher comment: rename function fac New student code:
// Recursive function that returns !n int fac(int n) { if(n == 0) return 1; else return oink(n-1); }
Which of course is trivial to detect in this simple function, but could have been avoided by writing
int oink(int n) { if(n == 0) return 1; else return this_function(n-1); }
Perhaps it could also be of use when a function is passed around in a variable - I'm not sure.
/ Peter Lundqvist (disjunkt)
Previous text:
2003-09-03 19:36: Subject: Re: Language comparisions
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
how is that different from this_object() ?
It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
Should we add Array.zip and Array.unzip to merge and split arrays.
how does that work?
array a = ({ 1,3,5,7 }); array b = ({ 2,4,6,8 }); Array.zip(a,b); ({1,2,3,4,5,6,7,8});
zip and unzip sound rather unintuitive in what they would do.
No, its a zipper. The name is from Haskell, merd, Python, Scheme and SML, which has the functionality.
/ Martin Nilsson (ja till euro, nej till cent)
indeed, i like it, would also aid readability,
also consider the usability in a lamda function
Bingo. That was sort of what I was after in the last section - but I didn't know it yet ;-)
/ Peter Lundqvist (disjunkt)
Previous text:
2003-09-04 17:22: Subject: Re: Language comparisions
indeed, i like it, would also aid readability,
also consider the usability in a lamda function
/ Brevbäraren
That's stupid. The teacher should of course show the student a refactoring tool which can do the rename while automatically preserving semantics. :-)
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-09-04 17:08: Subject: Re: Language comparisions
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
how is that different from this_object() ?
It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
I belive (as in 'don't know for sure') that this_function() would be used to reduce the possibility of function renaming errors when writing recursive functions.
Student code:
// Recursive function that returns !n int oink(int n) { if(n == 0) return 1; else return oink(n-1); }
Teacher comment: rename function fac New student code:
// Recursive function that returns !n int fac(int n) { if(n == 0) return 1; else return oink(n-1); }
Which of course is trivial to detect in this simple function, but could have been avoided by writing
int oink(int n) { if(n == 0) return 1; else return this_function(n-1); }
Perhaps it could also be of use when a function is passed around in a variable - I'm not sure.
/ Peter Lundqvist (disjunkt)
*LOL*
/ Peter Lundqvist (disjunkt)
Previous text:
2003-09-04 23:33: Subject: Re: Language comparisions
That's stupid. The teacher should of course show the student a refactoring tool which can do the rename while automatically preserving semantics. :-)
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
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.
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
Hm, I envisioned a more spiced-up version when I read about partition, for doing equivalence classes. Perhaps not quite as commonly useful, though:
mapping(mixed:array) partition( array input, function classify ) { mapping result = ([]); foreach( input, mixed elem ) { mixed type = classify( elem ); if( has_index( result, type ) ) result[type] += ({ elem }); else result[type] = ({ elem }); } return result; }
array stuff = ({ 1, 4.0, "8", 2, Stdio.File("/dev/null"), 17, "!" }); partition( stuff, lambda( mixed x ) { return sprintf("%t", x); } );
([ "float":({ 4.0 }),
"int":({ 1, 2, 17 }), "object":({ Stdio.File("/dev/null", 0, 777 /* fd=10 */) }), "string":({ "8", "!" }) ])
/ Johan Sundström (utan sälskap)
Previous text:
2003-09-04 00:06: Subject: Re: Language comparisions
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)
On Wed, Sep 03, 2003 at 06:10:02PM -0400, Martin Nilsson (ja till euro, nej till cent) @ Pike (-) developers forum wrote:
But the history function is usually broken in IRC. As is the log.
you are using the wrong irc client then. i have 1000 lines of history (and could have more) and a perfectly working log with ircii.
Is there an IRC client in Pike so that at least the client side annoyances can be fixed easily?
there is code. one would just have to add it to the roxen_chat client which could serve as the interface.
greetings, martin.
But the history function is usually broken in IRC. As is the log.
you are using the wrong irc client then. i have 1000 lines of history (and could have more) and a perfectly working log with ircii.
But that only works when you are logged in. I guess the bot could be updated to do something useful, and then integrate it with the client so that it fetches some scrollback from the log in the bot.
/ Martin Nilsson (ja till euro, nej till cent)
Previous text:
2003-09-04 00:38: Subject: Re: Language comparisions
On Wed, Sep 03, 2003 at 06:10:02PM -0400, Martin Nilsson (ja till euro, nej till cent) @ Pike (-) developers forum wrote:
But the history function is usually broken in IRC. As is the log.
you are using the wrong irc client then. i have 1000 lines of history (and could have more) and a perfectly working log with ircii.
Is there an IRC client in Pike so that at least the client side annoyances can be fixed easily?
there is code. one would just have to add it to the roxen_chat client which could serve as the interface.
greetings, martin.
/ Brevbäraren
you are using the wrong irc client then. i have 1000 lines of history (and could have more) and a perfectly working log with ircii.
But that only works when you are logged in. I guess the bot could be updated to do something useful, and then integrate it with the client so that it fetches some scrollback from the log in the bot.
You can use an IRC proxy too.
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)
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".
I believe it was meant to look like "constant myint = int" except that when a variable is declared as myint but without an initializer, it would get the value 7 rather than 0.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
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
Aha. That's an odd feature, methinks. Why would we want it?
/ Martin Stjernholm, Roxen IS
Previous text:
2003-09-04 02:08: Subject: Language comparisions
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".
I believe it was meant to look like "constant myint = int" except that when a variable is declared as myint but without an initializer, it would get the value 7 rather than 0.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
It's one of the ticks from the programming langauge D comparision chart. http://www.digitalmars.com/d/declaration.html#typedef
/ Martin Nilsson (ja till euro, nej till cent)
Previous text:
2003-09-04 02:11: Subject: Language comparisions
Aha. That's an odd feature, methinks. Why would we want it?
/ Martin Stjernholm, Roxen IS
Ok. They didn't motivate it either. Reading a little between the lines it seems it's mostly there to avoid a bias to a default init value like zero, i.e. symmetry purely for its own sake. I don't give much for such arguments.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-09-04 02:17: Subject: Language comparisions
It's one of the ticks from the programming langauge D comparision chart. http://www.digitalmars.com/d/declaration.html#typedef
/ Martin Nilsson (ja till euro, nej till cent)
I can certainly see some value in setting the default value of a type to "", ([]) or someting similar. I don't think it adds enough value to Pike to bother with it, but I don't dismiss it due to uselessness.
/ Martin Nilsson (ja till euro, nej till cent)
Previous text:
2003-09-04 02:23: Subject: Language comparisions
Ok. They didn't motivate it either. Reading a little between the lines it seems it's mostly there to avoid a bias to a default init value like zero, i.e. symmetry purely for its own sake. I don't give much for such arguments.
/ Martin Stjernholm, Roxen 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.
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
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?
Possibly.
Pliant has a four way (</=/>/not comparable) comparision function "compare". Should Pike that instead or at all?
Probably not.
Should we make an eval function like most other languages. mixed eval(string x) { return compile_string("mixed foo(){ "+x+";}")()->foo(); }
I don't think so. Python/Perl emphasize runtime compilation, Pike does not. (For god reasons)
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
Possibly, but what should it be called?
Should upper_case and lower_case be able to operate on integers (chars)?
Why not? Please submit a patch :)
Should we add Array.shift and Array.pop to remove elements in either end of the Array?
That wouldn't work (well), since array sizes cannot be modified destructively. You would have to encapsulate the array in another class first.
Note that arr=arr[1..]; and arr=arr[..sizeof(arr)-2]; are fairly well optimized, so there would probably be no need to implement this class in C.
Should we add Array.zip and Array.unzip to merge and split arrays.
What would that do?
Should we add Array.partition that splits an array into two (like filter with two outputs)?
What would that do?
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?
Possibly.
Should we add the possibility to define default values for types, e.g. typedef int myint = 7;
No. Although, you can already do typedef int(7..7) myint;
Do we need a Math.divmod?
Probably not, when would you use it?
Questions, questions...
/ Fredrik (Naranek) Hubinette (Real Build Master)
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)
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
Possibly, but what should it be called?
Should upper_case and lower_case be able to operate on integers (chars)?
Why not? Please submit a patch :)
Er.. like what? upper_case(141) == 65 ? or upper_case("1") == "!"?
I guess not the latter since it's pretty keyboard dependent =)
/ Peter Lundqvist (disjunkt)
Previous text:
2003-09-05 02:13: 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?
Possibly.
Pliant has a four way (</=/>/not comparable) comparision function "compare". Should Pike that instead or at all?
Probably not.
Should we make an eval function like most other languages. mixed eval(string x) { return compile_string("mixed foo(){ "+x+";}")()->foo(); }
I don't think so. Python/Perl emphasize runtime compilation, Pike does not. (For god reasons)
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
Possibly, but what should it be called?
Should upper_case and lower_case be able to operate on integers (chars)?
Why not? Please submit a patch :)
Should we add Array.shift and Array.pop to remove elements in either end of the Array?
That wouldn't work (well), since array sizes cannot be modified destructively. You would have to encapsulate the array in another class first.
Note that arr=arr[1..]; and arr=arr[..sizeof(arr)-2]; are fairly well optimized, so there would probably be no need to implement this class in C.
Should we add Array.zip and Array.unzip to merge and split arrays.
What would that do?
Should we add Array.partition that splits an array into two (like filter with two outputs)?
What would that do?
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?
Possibly.
Should we add the possibility to define default values for types, e.g. typedef int myint = 7;
No. Although, you can already do typedef int(7..7) myint;
Do we need a Math.divmod?
Probably not, when would you use it?
Questions, questions...
/ Fredrik (Naranek) Hubinette (Real Build Master)
"1" is already upper case. You might want to be able to downcase it, but I don't think Unicode has lower case digits.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-09-05 02:53: Subject: Language comparisions
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
Possibly, but what should it be called?
Should upper_case and lower_case be able to operate on integers (chars)?
Why not? Please submit a patch :)
Er.. like what? upper_case(141) == 65 ? or upper_case("1") == "!"?
I guess not the latter since it's pretty keyboard dependent =)
/ Peter Lundqvist (disjunkt)
On Thu, Sep 04, 2003 at 08:15:01PM -0400, Fredrik (Naranek) Hubinette (Real Build Master) @ Pike (-) developers forum wrote:
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
Possibly, but what should it be called?
this_function() ?
Should we add the possibility to define default values for types, e.g. typedef int myint = 7;
No. Although, you can already do typedef int(7..7) myint;
that is different. typedef int myint = 7; myint foo;
foo++; foo is now 8;
greetings, martin.
pike-devel@lists.lysator.liu.se