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

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 Per

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

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 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 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 C and > C 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 are aware of?

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 with

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

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: 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 coll

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 id

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

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 t

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

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

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 >

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: 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 c

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 wh

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; #

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 = 1&2&3; # all > my $x = 1\2\3; # none Pugs currently implements binary infix "!" as 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 = 1&2&3; # 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 (sho

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 l

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

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:

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 li

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 junc

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: 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 thoug

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 whi