Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Jonathan Scott Duff
On Sat, Feb 12, 2005 at 01:03:26AM -0600, Rod Adams wrote: > I also find the following incredibly disturbing: > > >perl6 -e "$x = 'cat'|'dog'; say $x;" > dog > cat Would that happen though? What's the signature of C? I think it's something like multi sub *say ($stream = $*OUT: *$data)

Re: Testing What Was Printed

2005-02-12 Thread Adrian Howard
On 11 Feb 2005, at 19:52, Shawn Sorichetti wrote: [snip] I've started working on Test::Output that is based on Schwern's TieOut module that comes with Test::More. I'm hoping to have it released on CPAN later tonight. Test::Output is a self contained so that it can be included with other modules

Re: Control Structures II: loop

2005-02-12 Thread Timothy S. Nelson
On Thu, 14 Nov 2002, Luke Palmer wrote: > > nest: > > Nest is the power loop thingy documented in Raphael Finkel's top notch > > book "Advanced Programming Language Design", near the end of the "Control > > Structures" chapter -- this book is in PDF format: > > http://www.nondot.org/sabre/Mi

Extra Operator bits?

2005-02-12 Thread Timothy S. Nelson
More hyper-operators Incidentally, is there any chance we'll have more than one official hyper-operator in Perl6? According to the S3, there's only one, "the" hyper-operator, >><<. If I understand, hyper-operators are just operators which operate on functions (incl

Re: Extra Operator bits?

2005-02-12 Thread Timothy S. Nelson
Ok, having just seen Damien's post about built-in methods, I can answer part of my own post: Re: more hyper-operators: reduce, thank-you! :) Of course, it'd still be better as a hyper-operator instead of a function (so that it works on operators too). I wrote: > (speaking of which,

CVS commit access

2005-02-12 Thread Bernhard Schmalhofer
Hi, I'm currently working on some Parrot bits, including some more cleanup of the test suite. For that it would be convenient to have commit right in CVS and rights in the RequestTracker. Could a kind soul set that up? My user ID on auth.perl.org is 'bernhard'. CU, Bernhard -- /* [EMAIL PROTE

Closure trait for loop entry

2005-02-12 Thread Joe Gottman
Often when I write a loop I want to run some code at loop entry time. It would be nice to have a closure trait for this, similar to NEXT for loop continuation or LAST for loop termination, but there isn't one. I don't think either FIRST or ENTER do quite what I want. FIRST runs only once, whi

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Patrick R. Michaud
On Sat, Feb 12, 2005 at 04:44:04PM +1100, Damian Conway wrote: > Patrick R. Michaud wrote: > > >>$x = $Value | 'Default'; > >>instead of : > >>$x = $Value || 'Default'; > > > > > >Hmm, this is an interesting point. I'll let others chime in here, > >as I don't have a good answer (nor am I at all a

Re: Junctive collapsing?

2005-02-12 Thread Autrijus Tang
On Sat, Feb 12, 2005 at 10:55:05AM -0600, Patrick R. Michaud wrote: > On Sat, Feb 12, 2005 at 12:09:37PM +0800, Autrijus Tang wrote: > > [...] > > - one() checks its operands for duplicates; if found, it collapses > > itself into an empty one() junction, thus failing all tests. > > Is thi

Re: Junctive collapsing?

2005-02-12 Thread Autrijus Tang
On Sat, Feb 12, 2005 at 11:10:13AM -0600, Patrick R. Michaud wrote: > No, consider > > $a = 1; > $b = 2; > > one($a, $a, $b) # false > one($b) # true Right. Evidently I need to sleep real soon. :-) However, is there a way to remove the $a from the equation? I'd like

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Patrick R. Michaud
On Sat, Feb 12, 2005 at 01:02:45PM +0800, Autrijus Tang wrote: > On Fri, Feb 11, 2005 at 02:12:51PM -0600, Patrick R. Michaud wrote: > > I briefly grepped through the apocalypses/synopses and couldn't > > find the answer -- how do I tell a scalar context to expect a > > junction of values? In part

Re: Junctive collapsing?

2005-02-12 Thread Patrick R. Michaud
On Sat, Feb 12, 2005 at 12:09:37PM +0800, Autrijus Tang wrote: > [...] > - one() checks its operands for duplicates; if found, it collapses > itself into an empty one() junction, thus failing all tests. > Is this somewhat saner? :-) Depends on when it's checking its operands for duplicat

Re: Junctive collapsing?

2005-02-12 Thread Patrick R. Michaud
On Sun, Feb 13, 2005 at 01:01:15AM +0800, Autrijus Tang wrote: > On Sat, Feb 12, 2005 at 10:55:05AM -0600, Patrick R. Michaud wrote: > > On Sat, Feb 12, 2005 at 12:09:37PM +0800, Autrijus Tang wrote: > > > [...] > > > - one() checks its operands for duplicates; if found, it collapses > > >

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Patrick R. Michaud
On Sat, Feb 12, 2005 at 12:41:19AM -0600, Rod Adams wrote: > >I've given here. For example, a junction can have a value like: > > $x = ($a & $b) ^ ($c & $d) > >which is true only if $a and $b are true or $c and $d are true but not > >both. > > That's why I allowed for virtual sets, defined by a

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Patrick R. Michaud
On Sat, Feb 12, 2005 at 03:49:02AM -0600, Jonathan Scott Duff wrote: > On Sat, Feb 12, 2005 at 01:03:26AM -0600, Rod Adams wrote: > > I also find the following incredibly disturbing: > > > > >perl6 -e "$x = 'cat'|'dog'; say $x;" > > dog > > cat > > Would that happen though? What's the signature

[perl #34117] [PATCH] fix make html

2005-02-12 Thread via RT
# New Ticket Created by Markus Amslser # Please include the string: [perl #34117] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/rt3/Ticket/Display.html?id=34117 > make html failes currently, because the src/test_main.c file was moved to examples/c

Re: Junctive collapsing?

2005-02-12 Thread Autrijus Tang
On Sat, Feb 12, 2005 at 06:34:05PM +0100, Eirik Berg Hanssen wrote: > I think one([EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]) is > equivalent to all(none([EMAIL PROTECTED]),one([EMAIL PROTECTED])), > which should permit an implementation using Sets without duplicate > elements. Whe

Re: Closure trait for loop entry

2005-02-12 Thread Uri Guttman
> "JG" == Joe Gottman <[EMAIL PROTECTED]> writes: JG>sub use_first() JG>{ JG> for 1..2 { JG> FIRST {say 'entering loop';} JG> say $_; JG> LAST{say 'leaving loop';} JG> } JG> } JG> The first time use_first is called it will pr

Re: Testing What Was Printed

2005-02-12 Thread David A. Golden
Michael G Schwern wrote: On Fri, Feb 11, 2005 at 07:30:24AM -0500, David Golden wrote: stdout_is { fcn() } $string, "comment"; # exact stdout_like{ fcn() } qr/regex/, "comment"; # regex match stdout_count { fcn() } qr/regex/, $count, "comment"; # number of matches stdout_found { fcn()

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Rod Adams
Patrick R. Michaud wrote: On Sat, Feb 12, 2005 at 03:49:02AM -0600, Jonathan Scott Duff wrote: On Sat, Feb 12, 2005 at 01:03:26AM -0600, Rod Adams wrote: I also find the following incredibly disturbing: perl6 -e "$x = 'cat'|'dog'; say $x;" dog cat Would that happen th

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Rod Adams
Patrick R. Michaud wrote: On Sat, Feb 12, 2005 at 12:41:19AM -0600, Rod Adams wrote: Of course we'll always have C. But this is Perl, and I want YAWTDI. After all, another way to test membership was just added, whereas before you pretty much just had C. ...another way to test membership wa

Re: Closure trait for loop entry

2005-02-12 Thread Larry Wall
On Sat, Feb 12, 2005 at 12:44:05PM -0500, Uri Guttman wrote: : > "JG" == Joe Gottman <[EMAIL PROTECTED]> writes: : : JG>sub use_first() : JG>{ : JG> for 1..2 { : JG> FIRST {say 'entering loop';} : JG> say $_; : JG> L

Re: Extra Operator bits?

2005-02-12 Thread Larry Wall
On Sat, Feb 12, 2005 at 05:55:48PM +1100, Timothy S. Nelson wrote: : More hyper-operators : : : Incidentally, is there any chance we'll have more than one official : hyper-operator in Perl6? According to the S3, there's only one, "the" : hyper-operator, >><<. If I un

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Patrick R. Michaud
On Sat, Feb 12, 2005 at 01:18:53PM -0600, Rod Adams wrote: > >>My issue is less that lists and sets are radically different. It is much > >>more a matter of Junctions and Scalars are radically different. Getting > >>me to accept that a Scalar holds several different values at once is a > >>hard sel

Re: Closure trait for loop entry

2005-02-12 Thread Uri Guttman
> "LW" == Larry Wall <[EMAIL PROTECTED]> writes: LW> : JG> The first time use_first is called it will print LW> : JG> entering loop LW> : JG> 1 LW> : JG> 2 LW> : JG> leaving loop LW> : LW> : JG> but subsequently it will print LW> : JG> 1 LW> : JG>

Re: Closure trait for loop entry

2005-02-12 Thread Larry Wall
On Sat, Feb 12, 2005 at 03:55:40PM -0500, Uri Guttman wrote: : LW> What's going on here is that the loop body is a closure that is : LW> cloned upon entry to the loop (you're logically passing a closure : LW> to the "for()" function that implements the loop), so if there's a : LW> FIRST ins

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Larry Wall
On Sat, Feb 12, 2005 at 02:20:45PM -0600, Patrick R. Michaud wrote: : > And I've yet to receive a good answer for what C<3/any(0,1)> does to $!. : : I'm sure that 3/any(0,1) throws some sort of divide by zero exception; : same as 3/0 would, and places the exception into $!. I don't know : that $!

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Rod Adams
Patrick R. Michaud wrote: On Sat, Feb 12, 2005 at 01:18:53PM -0600, Rod Adams wrote: My issue is less that lists and sets are radically different. It is much more a matter of Junctions and Scalars are radically different. Getting me to accept that a Scalar holds several different values at once

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Damian Conway
Rod Adams wrote: I also find the following incredibly disturbing: >perl6 -e "$x = 'cat'|'dog'; say $x;" dog cat That would be disturbing if that's what happened. C is just a shorthand for C. So saying a junction is the same as printing it, which is a run-time error. Can a junction hold values of

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Damian Conway
Autrijus wrote: FWIW, I also find it incredibly disturbing. Although I don't have to deal with it yet in the side-effect-free FP6, I think one way to solve this is for the "say" to return a junction of IO actions. No. It just throws an exception: Can't output a raw junction (did yo

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Jonathan Scott Duff
On Sat, Feb 12, 2005 at 12:19:46PM -0600, Rod Adams wrote: > I reread S09, and I believe "autothreading" is the wrong term for the > iteration that a junction incurs (Even though it appears in the section > immediately after Junctions. Autothreading is something far weirder, > dealing with part

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Damian Conway
Jonathan Scott Duff wrote: Let's set aside for the moment the fact that slurpy arrays/hashes aren't autothreaded and talk about a user-defined routine: sub foo ($alpha) { ... } It doesn't take much imagination to come up with a mechanism for Perl6 programmers to stop the autothreading: sub

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Jonathan Scott Duff
On Sun, Feb 13, 2005 at 09:53:36AM +1100, Damian Conway wrote: > Jonathan Scott Duff wrote: > >The down side is that programmers need to be more aware of > >subroutine/method side effects and write their programs accordingly. > > This is a *down*-side??? ;-) Indeed ;-) I'm using "programmer"

Re: Junctive collapsing?

2005-02-12 Thread Eirik Berg Hanssen
Autrijus Tang <[EMAIL PROTECTED]> writes: > On Sat, Feb 12, 2005 at 11:10:13AM -0600, Patrick R. Michaud wrote: >> No, consider >> >> $a = 1; >> $b = 2; >> >> one($a, $a, $b) # false >> one($b) # true > > Right. Evidently I need to sleep real soon. :-) > > However, is

Re: Fun with junctions (was Sets vs Junctions)

2005-02-12 Thread Rod Adams
Damian Conway wrote: Rod Adams wrote: I also find the following incredibly disturbing: >perl6 -e "$x = 'cat'|'dog'; say $x;" dog cat That would be disturbing if that's what happened. C is just a shorthand for C. So saying a junction is the same as printing it, which is a run-time error. So we ha

Re: Testing What Was Printed

2005-02-12 Thread Michael G Schwern
On Sat, Feb 12, 2005 at 12:47:56PM -0500, David A. Golden wrote: > >The trouble with this interface is sometimes you want to collect a bunch > >of output from a bunch of different functions together. > > That's why I suggested that it be prototyped to take a code block: > > stdout_is { > fcn1

[perl #34120] [PATCH] win32 bind, listen, accept

2005-02-12 Thread via RT
# New Ticket Created by Markus Amslser # Please include the string: [perl #34120] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/rt3/Ticket/Display.html?id=34120 > This patch extends the io NET_DEVEL with the 'server' functions bind, listen and acc

[perl #34121] [NEW] imc http server

2005-02-12 Thread via RT
# New Ticket Created by Markus Amslser # Please include the string: [perl #34121] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/rt3/Ticket/Display.html?id=34121 > Now it's getting funny. I have written a tiny webserver in imc, that can serve the p

Re: Testing What Was Printed

2005-02-12 Thread David A. Golden
Michael G Schwern wrote: On Sat, Feb 12, 2005 at 12:47:56PM -0500, David A. Golden wrote: The trouble with this interface is sometimes you want to collect a bunch of output from a bunch of different functions together. That's why I suggested that it be prototyped to take a code block: stdout_is {