Re: The Sort Problem (was: well, The Sort Problem)

2004-02-12 Thread Luke Palmer
Jonathan Lang writes: > > We already have that. It's spelled: > > > > routine [EMAIL PROTECTED]; > > > > Or > > > > routine * <== @x; > > Then you've got your solution: > > @sorted = sort {infix:<=> * map {$_.foo('bar').compute}, $^a, $^b } > @unsorted; > > or > > @

Re: cvs commit: parrot/src resources.c string.c utils.c

2004-02-12 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote: > A few more mod ops > +=item B(out PMC, in INT, in INT) I'm not sure if this is a good idea. We currently don't have any such kind of ops that takes 2 natural types and spits out a new PMC BTW, the doc above has out PMC, the implementation is: > +o

Re: dynamic arguments (was: The Sort Problem)

2004-02-12 Thread Jonathan Lang
Luke Palmer wrote: > Jonathan Lang writes: > > How about including something similar to <==, but which binds the > > elements of the list to the various positional parameters? For > > instance: > > > > @sorted = sort {infix:<=> args map {$_.foo('bar').compute}, > > $^a, $^b

Re: dynamic arguments (was: The Sort Problem)

2004-02-12 Thread Luke Palmer
Jonathan Lang writes: > How about including something similar to <==, but which binds the elements > of the list to the various positional parameters? For instance: > > @sorted = sort {infix:<=> args map {$_.foo('bar').compute}, $^a, $^b } > @unsorted; > > Where > > @x = $a, $

dynamic arguments (was: The Sort Problem)

2004-02-12 Thread Jonathan Lang
Jonathan Lang wrote: > Luke Palmer wrote: > > I've been thinking about this problem which comes up in my code a lot: > > > >@sorted = sort { $^a.foo('bar').compute <=> $^b.foo('bar').compute} > > @unsorted; > > > > Often the expressions on each side are even longer than that.

Re: Distributed testing idea

2004-02-12 Thread Randy W. Sims
On 2/12/2004 9:07 PM, Randy W. Sims wrote: How about a model that allows people to volunteer when they can (vs always). Say you have a server. You would be an author-client. You'd say I have this software that needs to be tested. The server would take it and mark it available for testing. Then

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread Jonathan Lang
Larry Wall wrote: > What I'm currently thinking about is a "does" predicate that tells you > if an object/class does a particular role completely. If you pull > part of a role into a class, it returns false, because it doesn't do > the complete role. However, if you use "like" instead, it returns

Re: Distributed testing idea

2004-02-12 Thread Randy W. Sims
On 2/11/2004 4:24 PM, Michael G Schwern wrote: The biggest time suck in developing MakeMaker, and to a lesser extent Test::More, is running the tests. Why? Because they need to be run on lots of different platforms with lots of different versions of Perl. Currently, I do this by hand. And we al

Re: The Sort Problem

2004-02-12 Thread Larry Wall
On Thu, Feb 12, 2004 at 04:29:58PM -0500, Uri Guttman wrote: : again, confusing. why should the order of a binary operator mean so : much? the order of a sort key is either ascending or descending. that is : what coders want to specify. translating that to the correct operator : (cmp or <=>) and th

Re: The Sort Problem

2004-02-12 Thread Larry Wall
On Thu, Feb 12, 2004 at 09:37:37PM +, Simon Cozens wrote: : [EMAIL PROTECTED] (Aaron Crane) writes: : > That is, rinfix: (or some other name) is like infix:, but gives you a : > function that reverses its arguments before actually running the operator. : > Perhaps it could even be implemented a

Re: The Sort Problem

2004-02-12 Thread Uri Guttman
> "AS" == Aaron Sherman <[EMAIL PROTECTED]> writes: AS> On Thu, 2004-02-12 at 15:46, Uri Guttman wrote: >> >> how do you select descending order? and how do you selecte that per >> key? >> you can't provide a binary operator without also providing the >> order. and what about di

Re: The Sort Problem

2004-02-12 Thread Aaron Sherman
On Thu, 2004-02-12 at 15:46, Uri Guttman wrote: > > "LP" == Luke Palmer <[EMAIL PROTECTED]> writes: > LP> Ok, I have to say, that's pretty good. Er, really good. I like it a > LP> lot. > > how do you select descending order? and how do you selecte that per key? > you can't provide a bin

Re: The Sort Problem

2004-02-12 Thread Simon Cozens
[EMAIL PROTECTED] (Dave Whipp) writes: > @sorted = sort { infix:<=> map { scalar $_.foo('bar').compute } @^_ } } > @data Abusing the rubyometer slightly: @data = @sorted.sort( op => &infix:<=>, key => { $^a.foo('bar').compute } ); -- If the code and the comments disagree, then both are probably

Re: The Sort Problem

2004-02-12 Thread Dave Whipp
Perhaps something like: @sorted = sort { infix:<=> map { scalar $_.foo('bar').compute } @^_ } } @data I'm not entirely sure it's readability is better than yours, though. Dave. "Luke Palmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've been thinking about this problem whi

Re: The Sort Problem

2004-02-12 Thread Simon Cozens
[EMAIL PROTECTED] (Aaron Crane) writes: > One option might be an 'rsort' function, but I think that's somewhat lacking > in the taste department. Agreed. > Another might be as simple as > > @unsorted ==> sort ==> reverse ==> @sorted; @sorted <== sort <== @unsorted, no? ;) > @unsorted ==>

Re: The Sort Problem

2004-02-12 Thread Luke Palmer
Aaron Crane writes: > I have one other idea, but I can't decide if I like it: > > @unsorted ==> sort &rinfix:cmp ==> @sorted; > > That is, rinfix: (or some other name) is like infix:, but gives you a > function that reverses its arguments before actually running the operator. > Perhaps it could

Re: The Sort Problem

2004-02-12 Thread Uri Guttman
> "AC" == Aaron Crane <[EMAIL PROTECTED]> writes: AC> One option might be an 'rsort' function, but I think that's AC> somewhat lacking in the taste department. AC> Another might be as simple as AC> @unsorted ==> sort ==> reverse ==> @sorted; again, reverse order needs to be on a p

Re: The Sort Problem

2004-02-12 Thread Aaron Crane
Luke Palmer wrote: > Aaron Crane writes: > > @unsorted > > ==> sort &infix:<=>, desc => 1, key => { $_.foo('bar').compute } > > ==> @sorted; > > I don't like the C flag. But I can't, at the moment, think of any > way around it short of: > > @unsorted > ==> sort { $^b <=> $^

JIT & branches under the Sun

2004-02-12 Thread Stephane Peiry
Hi All, While playing with JIT on Suns, I've found out that the following pasm code: set I1, 2 LOOP: sub I1, 1 ifI1, LOOP print "end\n" end never finishes.. that is: parrot -j loop.pasm hangs forever (never printing 'end') while the non-jitted

Re: The Sort Problem

2004-02-12 Thread Uri Guttman
> "PM" == Ph Marek <[EMAIL PROTECTED]> writes: >> ... >> so here is a (very rough and probably broken) syntax idea building on >> that: >> >> sort :key { :descend :string .foo('bar').substr( 10, 3) } >> >> :key { :int .foo('baz') } >> :key { :float .foo('amo

Re: The Sort Problem

2004-02-12 Thread Uri Guttman
> "LP" == Luke Palmer <[EMAIL PROTECTED]> writes: >> # P5: @sorted = sort { $a->foo('bar')->compute <=> $b->foo('bar')->compute } >> # @unsorted >> # or: @sorted = map { $_->[1] } >> # sort { $a->[0] <=? $b->[0] } >> # map { [ $_->foo('bar')-

Re: The Sort Problem

2004-02-12 Thread Luke Palmer
Aaron Crane writes: > Luke Palmer wrote: > > Any other ideas? > > How about something like this, modulo any errors in my Perl 6 syntax? > > sub sort(?&cmp = &infix:cmp, +$key, +$desc, [EMAIL PROTECTED]) { ... } > > I think that allows all of these: > > # P5: @sorted = sort @unsorted; > @s

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread Robin Berjon
Larry Wall wrote: I only see like() as counting the methods available through the public contract to determine its percentage. Something you could do by hand with .can(). But there wouldn't be much point in putting it in if people won't use it. On the other hand, if people want it and it's not t

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread Larry Wall
On Thu, Feb 12, 2004 at 12:02:50PM -0800, chromatic wrote: : Is it more useful to find the Dog-like-ness of a class or the notion : that SomeClass.bark() is semantically Dog-like, not Tree-like? I expect we'd use .can() for method-based queries. : I expect to care more that the object does someth

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread chromatic
On Thu, 2004-02-12 at 11:49, Larry Wall wrote: > What I'm currently thinking about is a "does" predicate that tells you > if an object/class does a particular role completely. If you pull > part of a role into a class, it returns false, because it doesn't do > the complete role. However, if you

Re: The Sort Problem

2004-02-12 Thread Larry Wall
On Thu, Feb 12, 2004 at 12:07:37PM +0100, Ph. Marek wrote: : > ... : > so here is a (very rough and probably broken) syntax idea building on : > that: : > : > sort :key { :descend :string .foo('bar').substr( 10, 3) } : > : > :key { :int .foo('baz') } : > :key { :float .f

Re: cvs commit: parrot/imcc/t/syn file.t

2004-02-12 Thread Adam Thomason
Hmm, this is still wrong. The error message isn't just a function of the locale; it's also dependent on the OS. AIX is now back to expecting "No such file or directory" courtesy of LANG=C when the imcc error is "A file or directory in the path name does not exist." That's English, just not th

Re: [PATCH] library/sdl_types.imc

2004-02-12 Thread chromatic
On Thu, 2004-02-12 at 05:26, Jens Rieks wrote: > here is a small pach for _SDL_loop that fixes a crashes that occurs if you > press a key that has no entry in the key_events hash. Thanks, applied! -- c

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread Larry Wall
On Thu, Feb 12, 2004 at 11:03:57AM -0800, chromatic wrote: : On a conceptual level, the different syntax is the worst crime because : it reinforces the idea that the important question about an object is : "What is this object's position in a class hierarchy?", not "Does this : object have the same

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread chromatic
On Thu, 2004-02-12 at 05:52, Aaron Sherman wrote: > Perhaps I'm slow, but I don't see the difference between a trait and a > Java interface other than the fact that traits appear to be more of a > run-time construct. The easy answer is that interfaces completely suck while traits don't. :) Seri

Re: [PATCH] library/sdl_constants.imc

2004-02-12 Thread chromatic
On Thu, 2004-02-12 at 05:57, Jens Rieks wrote: > here is a patch that adds all SDLK_ values. > The values are added to "sdl_keysyms", which is just an alias at the moment. > The constants hash is know also stored as a global and is created only once. Thanks, applied! -- c

Re: Build broken due to missing inet_aton on Solaris 8

2004-02-12 Thread Melvin Smith
At 05:16 PM 2/12/2004 +0100, Leopold Toetsch wrote: Melvin Smith <[EMAIL PROTECTED]> wrote: > I'm not sure why Leo changed it, but I'll put it back. I'm not sure either ;) Must have been in one of the cleanup or such patches, I had put in. Sorry, No problem. I haven't really taken a survey of whi

Re: [perl] The Sort Problem

2004-02-12 Thread Dan Sugalski
At 11:40 PM -0500 2/11/04, Joe Gottman wrote: This is unrelated to the problem you mentioned, but there is another annoying problem with sort as it is currently defined. If you have an @array and you want to replace it with the sorted version, you have to type @array = sort @array; That wou

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread Larry Wall
Yes, that's a very good paper, which is why Perl 6 now has something called Roles, which are intended to degenerate either to Traits or Interfaces. My take on it is that Roles' most important, er, role will be to abstract out the decision to compose or delegate. But we'd like them to function as

Re: PATCH: Trivial typo patch for config/init/headers.pl

2004-02-12 Thread chromatic
On Thu, 2004-02-12 at 07:17, Art Haas wrote: > Add in a missing 'n'. Also, the file 'config/auto/byteorder.pl' is missing a > newline at the end of the file. A simple open and save in vim would fix > that up. Thanks, applied. -- c

Re: Build broken due to missing inet_aton on Solaris 8

2004-02-12 Thread Leopold Toetsch
Melvin Smith <[EMAIL PROTECTED]> wrote: > I'm not sure why Leo changed it, but I'll put it back. I'm not sure either ;) Must have been in one of the cleanup or such patches, I had put in. Sorry, leo

PATCH: Trivial typo patch for config/init/headers.pl

2004-02-12 Thread Art Haas
Hi. Add in a missing 'n'. Also, the file 'config/auto/byteorder.pl' is missing a newline at the end of the file. A simple open and save in vim would fix that up. Parrot builds nicely on my old machine. $ ./parrot -j ./examples/assembly/mops.pasm Iterations:1 Estimated ops: 2

Re: Build broken due to missing inet_aton on Solaris 8

2004-02-12 Thread Melvin Smith
At 10:26 AM 2/12/2004 -0500, Andrew Dougherty wrote: A fresh checkout of parrot won't build for me due to the missing inet_aton symbol on Solaris 8. My perl5 configuration correctly records $Config{d_inetaton}=undef, but io_unix.o unconditionally expects inet_aton. cc -o parrot -L/usr/local/lib -R

Build broken due to missing inet_aton on Solaris 8

2004-02-12 Thread Andrew Dougherty
A fresh checkout of parrot won't build for me due to the missing inet_aton symbol on Solaris 8. My perl5 configuration correctly records $Config{d_inetaton}=undef, but io_unix.o unconditionally expects inet_aton. cc -o parrot -L/usr/local/lib -R/usr/local/lib imcc/main.o \ blib/lib/libpar

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread Dmitry Dorofeev
Aaron Sherman wrote: Perhaps I'm slow, but I don't see the difference between a trait and a Java interface other than the fact that traits appear to be more of a run-time construct. Java interfaces are actually a very nice compromise between multiple and single inheritance. You can not get rid of t

[PATCH] library/sdl_constants.imc

2004-02-12 Thread Jens Rieks
Hi again, here is a patch that adds all SDLK_ values. The values are added to "sdl_keysyms", which is just an alias at the moment. The constants hash is know also stored as a global and is created only once. jens diff -u -w -r1.1 sdl_constants.imc --- library/sdl_constants.imc 10 Feb 2004 04:

Re: Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread Aaron Sherman
On Thu, 2004-02-12 at 08:14, Dmitry Dorofeev wrote: > I see that i am not alone in my thoughts about classic OO drawbacks. > Some smart people created traits for SmallTalk which is something > close to what i want. Perhaps I'm slow, but I don't see the difference between a trait and a Java interf

Re: The Sort Problem

2004-02-12 Thread Aaron Sherman
On Thu, 2004-02-12 at 08:43, Aaron Sherman wrote: > sub sortpairs(&@) { > my $comp = shift; > my %pairs = @_; > return map {$pairs{$_}} sort {$comp->($a)} keys %pairs; > } Doh... it's early for me. That's C()}> with no parameter. The fact that $a and $b are dynamically scoped in Perl 5 help

Re: The Sort Problem

2004-02-12 Thread Aaron Sherman
On Thu, 2004-02-12 at 01:59, Uri Guttman wrote: > sorry about the confusion. read the paper at: > > http://www.sysarch.com/perl/sort_paper.html All of which stops being a concern if you have a sort variant that works on pairs in the first place. Perl _5_ code follows: sub sortpairs(&@) {

Traits: to renew OO inheritance in a hacker style discussion

2004-02-12 Thread Dmitry Dorofeev
Hi all, I see that i am not alone in my thoughts about classic OO drawbacks. Some smart people created traits for SmallTalk which is something close to what i want. Traits are mechanism, recently proposed by Scharli et al, for factoring Smalltalk class hierarchies. By separating the issue of code

Re: cvs commit: parrot/imcc/t/syn file.t

2004-02-12 Thread Leopold Toetsch
Jens Rieks <[EMAIL PROTECTED]> wrote: > The test has to be located inside the eval, this construct has no effect. > Might it be better to set LANG to 'C', instead of 'en'? Thanks, applied. leo

[PATCH] library/sdl_types.imc

2004-02-12 Thread Jens Rieks
Hi chromatic, here is a small pach for _SDL_loop that fixes a crashes that occurs if you press a key that has no entry in the key_events hash. jens diff -u -w -r1.5 sdl_types.imc --- library/sdl_types.imc 10 Feb 2004 19:31:49 - 1.5 +++ library/sdl_types.imc 12 Feb 2004 13:22:21 - @@ -409

Re: cvs commit: parrot/imcc/t/syn file.t

2004-02-12 Thread Jens Rieks
Am Donnerstag, 12. Februar 2004 08:18 schrieb Leopold Toetsch: [snip] > eval { local $ENV{LANG} = 'en'; }; [snip] The test has to be located inside the eval, this construct has no effect. Might it be better to set LANG to 'C', instead of 'en'? 'en' in not installed on my system, but 'C' is in eng

Re: Distributed testing idea

2004-02-12 Thread Philippe 'BooK' Bruhat
Le mercredi 11 février 2004 à 13:24, Michael G Schwern écrivait: > > Here's a simple sketch of what I'd imagine the protocol would look like. > I'm not much on networking, so I'm going to keep it simple. HTTP is > simple. I'd also like to make running a test server as simple and > portable as po

Re: The Sort Problem

2004-02-12 Thread Ph. Marek
> ... > so here is a (very rough and probably broken) syntax idea building on > that: > > sort :key { :descend :string .foo('bar').substr( 10, 3) } > > :key { :int .foo('baz') } > :key { :float .foo('amount') } @unsorted ; I see a kind of problem here: If the parts of th

Re: The Sort Problem

2004-02-12 Thread Aaron Crane
Luke Palmer wrote: > Any other ideas? How about something like this, modulo any errors in my Perl 6 syntax? sub sort(?&cmp = &infix:cmp, +$key, +$desc, [EMAIL PROTECTED]) { ... } I think that allows all of these: # P5: @sorted = sort @unsorted; @sorted = sort @unsorted; The simplest case

Re: [perl] The Sort Problem

2004-02-12 Thread Deborah Pickett
On Thu, 12 Feb 2004 15.40, Joe Gottman wrote: >This is unrelated to the problem you mentioned, but there is another > annoying problem with sort as it is currently defined. If you have an > @array and you want to replace it with the sorted version, you have to type > @array = sort @array;

Re: [NEW] library/sort.imc

2004-02-12 Thread Leopold Toetsch
Jens Rieks <[EMAIL PROTECTED]> wrote: >=head1 TITLE > library/sort.imc - simple sort algorithm implemented in PIR ... >=head1 TITLE >dumper.imc - PIR version of Data::Dumper I've applied both. I've dropped the tests in t/pmc. Thanks, leo