Re: Pop a Hash?

2005-02-11 Thread David Storrs
On Wed, Feb 09, 2005 at 05:13:56AM -0600, Rod Adams wrote: Does ($k, $v) == pop %hash; or ($k, $v) == %hash.pop; make sense to anyone except me? It's clear to me. The only thing is that, right off the top of my head, I can't see where it would be used. Since the order in which the

Re: Fwd: Junctive puzzles.

2005-02-11 Thread Patrick R. Michaud
On Thu, Feb 10, 2005 at 12:02:01PM -0600, Rod Adams wrote: Patrick R. Michaud wrote: Even if you fixed the =/and precedence with parens, to read my $x = (any(2,3,4,5) and any(4,5,6,7)); then I think the result is still that $x contains any(4,5,6,7). Funny. I thought $x would

thank you for clarification (was Re: S04)

2005-02-11 Thread David Storrs
On Thu, Feb 10, 2005 at 09:45:59AM -0800, Larry Wall wrote: That's spelled loop { $foo = readline; ...do stuff with $foo... } while ( $foo ); these days. Larry Cool, perfect. Thanks. --Dks -- [EMAIL PROTECTED]

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
David Cantrell wrote: Jim Keenan wrote: Using the standard Test::More framework, is it possible to test whether what was printed to a filehandle matches a predetermined string or list of strings? Would IO::Capture be of help here? And here are the fruits of my application of IO::Capture: a

Re: Fwd: Junctive puzzles.

2005-02-11 Thread Patrick R. Michaud
On Thu, Feb 10, 2005 at 12:02:01PM -0600, Rod Adams wrote: [...] If this is the case, then this entire discussion collapses into how to best convert arrays into junctions and junctions into arrays. Perl's existing abilities to edit arrays should be more than sufficient for editing

Fwd: Fwd: Junctive puzzles.

2005-02-11 Thread Thomas Yandell
Going to get the hang of this sending to a list thing soon. -- Forwarded message -- From: Thomas Yandell [EMAIL PROTECTED] Date: Fri, 11 Feb 2005 09:40:03 + Subject: Re: Fwd: Junctive puzzles. To: Patrick R. Michaud [EMAIL PROTECTED] If only I could just do something like:

Re: Testing What Was Printed

2005-02-11 Thread David Golden
My $0.02: Very nice integration of IO::Capture. I think this is very promising, but all the start(), stop() calls seem overly repetitive to me. What about refactoring it into a set of test functions that handle it for the user automatically? Just quickly off the cuff, what about a test module

Happy day (was: Junctive Puzzles)

2005-02-11 Thread Autrijus Tang
On Fri, Feb 11, 2005 at 09:42:06AM +, Thomas Yandell wrote: perl6 -MData::Dumper -e 'print Dumper(any(2,3,4,5) any(4,5,6,7))' ...then I could easily find out for myself. Until that happy day I will have to ask you guys to clear it up for me. Seems today is indeed that happy day: %

Re: Happy day (was: Junctive Puzzles)

2005-02-11 Thread Thomas Yandell
Very impressive. Has inspired me to learn some Haskell. Thanks, Tom On Fri, 11 Feb 2005 21:17:35 +0800, Autrijus Tang [EMAIL PROTECTED] wrote: On Fri, Feb 11, 2005 at 09:42:06AM +, Thomas Yandell wrote: perl6 -MData::Dumper -e 'print Dumper(any(2,3,4,5) any(4,5,6,7))' ...then I could

proposal: use \ as none junction delimeter

2005-02-11 Thread Thomas Sandlaß
HaloO All, it just occured to me that the lone single character reference operator '\' is badly Huffman coded! These days references are pretty much automagical. So my idea is to replace '\' with e.g. '\*' which puts it in opposition to the flattening '*' and '**' operators. And there should be a

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
David Golden wrote: My $0.02: Very nice integration of IO::Capture. I think this is very promising, but all the start(), stop() calls seem overly repetitive to me. Agreed. What about refactoring it into a set of test functions that handle it for the user automatically? Just quickly off the

Re: proposal: use \ as none junction delimeter

2005-02-11 Thread Aldo Calpini
Thomas Sandlaß wrote: my $x = 1|2|3; # any my $x = 1^2^3; # one my $x = 123; # all my $x = 1\2\3; # none [...] if $a $b { ... } # and if $a || $b { ... } # or if $a ^^ $b { ... } # xor if $a // $b { ... } # err if $a \\ $b { ... } # nor Well? that's all very Huffy (short

Re: proposal: use \ as none junction delimeter

2005-02-11 Thread Autrijus Tang
On Fri, Feb 11, 2005 at 06:48:29PM +0100, Thomas Sandla wrote: Accepting the above completes the junction constructing operators: my $x = 1|2|3; # any my $x = 1^2^3; # one my $x = 123; # all my $x = 1\2\3; # none Pugs currently implements binary infix ! as the none

Re: proposal: use \ as none junction delimeter

2005-02-11 Thread Luke Palmer
Thomas Sandla writes: This gives: my @x = (1,2,3); my $x = [1,2,3]; my $x = ref (1,2,3); # also without ()? my $x = \* (1,2,3); # also without ()? Accepting the above completes the junction constructing operators: my $x = 1|2|3; # any my $x = 1^2^3; # one my $x

Re: proposal: use \ as none junction delimeter

2005-02-11 Thread Thomas Sandlaß
Autrijus Tang wrote: as well as the non-short-circuitting !! logical operator, and the lower-precedenced nor. I'm not sure if '!' fits the heavy weight perl6 grammar. But why is 'nor' not short-circuitting? It only continues when the left side is true --- like '||' and '//'. At least this is what

Re: proposal: use \ as none junction delimeter

2005-02-11 Thread Autrijus Tang
On Fri, Feb 11, 2005 at 07:45:33PM +0100, Thomas Sandla wrote: Autrijus Tang wrote: as well as the non-short-circuitting !! logical operator, and the lower-precedenced nor. I'm not sure if '!' fits the heavy weight perl6 grammar. But why is 'nor' not short-circuitting? It only continues

Junctive collapsing?

2005-02-11 Thread Autrijus Tang
On Fri, Feb 11, 2005 at 09:42:06AM +, Thomas Yandell wrote: Is there another operator that takes the intersection of two junctions, such that any(2,3,4,5) *some op* any(4,5,6,7) would result in any(4,5)? Yes. In Pugs 6.0.3 (released one minute ago), that operator is simply called : %

Re: Testing What Was Printed

2005-02-11 Thread Michael G Schwern
On Fri, Feb 11, 2005 at 07:30:24AM -0500, David Golden wrote: Very nice integration of IO::Capture. I think this is very promising, but all the start(), stop() calls seem overly repetitive to me. What about refactoring it into a set of test functions that handle it for the user

Re: Testing What Was Printed

2005-02-11 Thread Shawn Sorichetti
On Feb 11, 2005, at 2:44 PM, Michael G Schwern wrote: On Fri, Feb 11, 2005 at 07:30:24AM -0500, David Golden wrote: Very nice integration of IO::Capture. I think this is very promising, but all the start(), stop() calls seem overly repetitive to me. What about refactoring it into a set of test

Re: Testing What Was Printed

2005-02-11 Thread Tels
-BEGIN PGP SIGNED MESSAGE- Moin, On Friday 11 February 2005 21:08, David H. Adler wrote: On Thu, Feb 10, 2005 at 09:28:30PM -0500, James E Keenan wrote: And here are the fruits of my application of IO::Capture: a module with three subroutines which have proven useful in the project

Re: Junctive collapsing?

2005-02-11 Thread Patrick R. Michaud
On Sat, Feb 12, 2005 at 03:28:15AM +0800, Autrijus Tang wrote: On Fri, Feb 11, 2005 at 09:42:06AM +, Thomas Yandell wrote: Is there another operator that takes the intersection of two junctions, such that any(2,3,4,5) *some op* any(4,5,6,7) would result in any(4,5)? Yes. In Pugs

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Patrick R. Michaud
Woops! I just realized I factored something wrongly...!? On Fri, Feb 11, 2005 at 01:22:51PM -0600, Patrick R. Michaud wrote: # return true if $x is a factor of $y sub is_factor (Scalar $x, Scalar $y) { $y % $x == 0 } [...] # a (somewhat inefficient?) is_prime test for $bar

Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Patrick R. Michaud
On Fri, Feb 11, 2005 at 12:54:39AM -0600, Rod Adams wrote: Damian writes: Junctions have an associated boolean predicate that's preserved across operations on the junction. Junctions also implicitly distribute across operations, and rejunctify the results. My brain is having trouble fully

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Rod Adams
Patrick R. Michaud wrote: For example, with the less than or equals (=) relational operator, the expression any(2,3,4) = 3 becomes any( 2 = 3,# 1 (true) 3 = 3,# 1 (true) 4 = 3 # 0 (false) ) which ultimately becomes any(1,0), because = is an operator that

Re: Pop a Hash?

2005-02-11 Thread Ashley Winters
On Thu, 10 Feb 2005 08:59:04 -0800, David Storrs [EMAIL PROTECTED] wrote: On Wed, Feb 09, 2005 at 05:13:56AM -0600, Rod Adams wrote: Does ($k, $v) == pop %hash; or ($k, $v) == %hash.pop; make sense to anyone except me? ... the only time it's useful is if you want to process

Re: Junctive collapsing?

2005-02-11 Thread Autrijus Tang
On Fri, Feb 11, 2005 at 01:42:42PM -0600, Patrick R. Michaud wrote: This collapse is probably wrong. In particular, any($a, $b)any($b, $c) is not the same as any($a, $b, $c) Right. Teaches me that implementing nontrivial features on 3am just-before-sleep is probably a bad idea.

Re: Junctive collapsing?

2005-02-11 Thread Autrijus Tang
On Sat, Feb 12, 2005 at 03:28:15AM +0800, Autrijus Tang wrote: Yes. In Pugs 6.0.3 (released one minute ago), that operator is simply called : I satnd corrected. The implementation is incorrect. Pugs 6.0.4 has just been released (now with the eval primitive!), it has cleaned up the collapsing

Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Patrick R. Michaud
Rod Adams wrote: I would argue that this sort of relational comparison is of limited usefulness. Well, except junctions hold more information than the simple comparisons I've given here. For example, a junction can have a value like: $x = ($a $b) ^ ($c $d) which is true only if $a

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Autrijus Tang
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 particular, is there a way for me to pass a junction to a routine without it

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Damian Conway
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 authoritative on junctions). This is merely syntax; it doesn't really have anything to do

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Autrijus Tang
On Sat, Feb 12, 2005 at 04:44:04PM +1100, Damian Conway wrote: BTW, I'm pretty sure there will be built-in CArray::uniq and CList::uniq methods in Perl 6. So that's just: @xyz = uniq @xyz; or better still: @xyz.=uniq; Is there other built-in methods not found in perl5 that you

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Rod Adams
Patrick R. Michaud wrote: Rod Adams wrote: I would argue that this sort of relational comparison is of limited usefulness. Well, except junctions hold more information than the simple comparisons I've given here. For example, a junction can have a value like: $x = ($a $b) ^ ($c $d)

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Rod Adams
Damian Conway wrote: Patrick R. Michaud wrote: Ultimately I don't think I agree with the notion that sets and lists are so different, or that sets deserve/require their own sigil. Sets shouldn't have a sigil anyway, whether they're qualitatively different from lists or not. A set is a *value*

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Autrijus Tang
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 Getting iterated executions of a statement without explicitly iterating it bothers me greatly. I work heavily in databases, where updating

Re: Fun with junctions (was Sets vs Junctions)

2005-02-11 Thread Damian Conway
Autrijus wrote: Is there other built-in methods not found in perl5 that you are aware of? Yes. I'd like to work out declarations and implementations of them in one sweep, if possible. :-) Hah! Dream on! I don't think we have a canonical list anywhere (except in Larry's head). Some non-Perl-5

The IO context (was: Fun with junctions)

2005-02-11 Thread Autrijus Tang
On Sat, Feb 12, 2005 at 03:16:20PM +0800, Autrijus Tang wrote: the toplevel sequencing only handles IO of ... types, so the junction above will not print anything. Instead it may raise a warning of using a Junction in a void context, or something equally ominous. Thinking about it, that

Test::Builder Cookbook

2005-02-11 Thread Joe McMahon
Started on the qa-wiki. First entry: how to return an internal failure as a proper test failure so that Test::Builder::Tester and Test::Tester will like it. --- Joe M.

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
David H. Adler wrote: A question: is there any reason that you made this an OO module but still show calls to the methods as functions rather than methods on the object? An answer: It was a quick hack based on my first day's experience with IO::Capture::Stdout. Its original rationale was

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
Shawn Sorichetti wrote: 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, and no prereqs. Right now it

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
Tels wrote: On Friday 11 February 2005 21:08, David H. Adler wrote: Just askin'. :-) In similiar line of thought: Why verify_number_lines instead of the (much shorter :) lines? Speaking source code is something I like, but it shouldn't gabble on :) Oh, and why TestAuxiliary and not