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

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

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

Re: Junctive puzzles.

2005-02-10 Thread Matthew Walton
Matt Fowles wrote: This is Just Wrong, IMO. How confusing is it going to be to find that calling is_prime($x) modifies the value of $x despite it being a very simple test operation which appears to have no side effects? As far as I can see it, in the example, it's perfectly logical for

Fwd: Junctive puzzles.

2005-02-10 Thread Thomas Yandell
Sorry if you get this twice (and slightly different), but I posted it off list by mistake. -- Forwarded message -- From: Thomas Yandell [EMAIL PROTECTED] Date: Thu, 10 Feb 2005 10:22:44 + Subject: Re: Junctive puzzles. To: Matthew Walton [EMAIL PROTECTED] What if junctions

Re: [rbw3@cse.nau.edu: Re: Junctive puzzles.]

2005-02-10 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: Yes... but perhaps instead of the above transform we should just make sure that is transitive in the first place... so that no matter what if ab and bc then ac. OTOH... perhaps we are working with partially ordered sets (rather than completely ordered sets)? In that case

Re: Junctive puzzles.

2005-02-10 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: What if junctions collapsed into junctions of the valid options under some circumstances, so my $x = any(1,2,3,4,5,6,7); if(is_prime($x) # $x = any(2,3,5,7) and is_even($x) # $x = any(2) and $x 2) # $x = any() This is Just Wrong, IMO. How confusing is it going to be to

Re: Fwd: Junctive puzzles.

2005-02-10 Thread Patrick R. Michaud
On Thu, Feb 10, 2005 at 10:42:34AM +, Thomas Yandell wrote: Is the following comment correct? my $x = any(2,3,4,5) and any(4,5,6,7); # $x now contains any(4,5) Short answer: I don't think so. Long answer: I tend to get very lost when dealing with junctions, so I can be completely

Re: Fwd: Junctive puzzles.

2005-02-10 Thread Rod Adams
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 contain 'true' here, since Cand was a boolean operator. But I could be very

Re: Fwd: Junctive puzzles.

2005-02-10 Thread Damian Conway
Patrick Michaud wrote: On Thu, Feb 10, 2005 at 10:42:34AM +, Thomas Yandell wrote: Is the following comment correct? my $x = any(2,3,4,5) and any(4,5,6,7); # $x now contains any(4,5) Short answer: I don't think so. Long answer: decloak Patrick is right on the money here...as usual. (Don't

Re: Fwd: Junctive puzzles.

2005-02-10 Thread Damian Conway
Rod Adams wrote: The overall impression I'm getting here is that we need some syntax for saying: $x = any(1..1000) such_that is_prime($x); In standard Perl 6 that'd be: $x = any(grep {is_prime $^x} 1..1000); or, if you prefer your constraints postfixed: $x = any( (1..1000).grep({is_prime

Sets vs Junctions (was Junctive puzzles.)

2005-02-10 Thread Rod Adams
Damian Conway wrote: Rod Adams wrote: The overall impression I'm getting here is that we need some syntax for saying: $x = any(1..1000) such_that is_prime($x); In standard Perl 6 that'd be: $x = any(grep {is_prime $^x} 1..1000); or, if you prefer your constraints postfixed: $x = any(

Re: [rbw3@cse.nau.edu: Re: Junctive puzzles.]

2005-02-09 Thread Brock
On 2005.02.08.19.07, Matt Fowles wrote: | Brock~ | | | On Tue, 8 Feb 2005 12:08:45 -0700, Brock [EMAIL PROTECTED] wrote: | | Hm. I take that back... it was a silly comment to make and not very | mathematically sound. Sorry. | | --Brock | | - Forwarded message from Brock [EMAIL

Re: Junctive puzzles.

2005-02-09 Thread Matthew Walton
Matt Fowles wrote: All~ On Tue, 08 Feb 2005 17:51:24 +0100, Miroslav Silovic [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Well, we see the same kind of thing with standard interval arithmetic: (-1, 1) * (-1, 1) = (-1, 1) (-1, 1) ** 2 = [0, 1) The reason that junctions behave this way is

Re: Junctive puzzles.

2005-02-09 Thread Matt Fowles
All~ On Wed, 09 Feb 2005 22:48:00 +, Matthew Walton [EMAIL PROTECTED] wrote: Matt Fowles wrote: All~ On Tue, 08 Feb 2005 17:51:24 +0100, Miroslav Silovic [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Well, we see the same kind of thing with standard interval arithmetic:

Re: Junctive puzzles.

2005-02-09 Thread David Green
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Luke Palmer) wrote: Well, we see the same kind of thing with standard interval arithmetic: [...] It didn't bother me that junctions weren't ordered transitively. (Ordering had better work transitively for ordinary numbers, but junctions aren't

Re: Junctive puzzles.

2005-02-08 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: Yup. My mathematic intuition cannot suffer that: 4 X 2 to be true in any circumstances -- as it violates associativity. If one wants to violate associativity, one should presumably *not* use the chained comparison notation! So Pugs will evaluate that to (#f|#f), by

Re: Junctive puzzles.

2005-02-08 Thread Luke Palmer
Miroslav Silovic writes: [EMAIL PROTECTED] wrote: So Pugs will evaluate that to (#f|#f), by lifting all junctions out of a multiway comparison, and treat the comparison itself as a single variadic operator that is evaluated as a chain individually. I think this is correct, however... this is

Re: Junctive puzzles.

2005-02-08 Thread Luke Palmer
Luke Palmer writes: Miroslav Silovic writes: [EMAIL PROTECTED] wrote: So Pugs will evaluate that to (#f|#f), by lifting all junctions out of a multiway comparison, and treat the comparison itself as a single variadic operator that is evaluated as a chain individually. I think this is

Re: Junctive puzzles.

2005-02-08 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: Well, we see the same kind of thing with standard interval arithmetic: (-1, 1) * (-1, 1) = (-1, 1) (-1, 1) ** 2 = [0, 1) The reason that junctions behave this way is because they don't collapse. You'll note the same semantics don't arise in Quantum::Entanglement

Re: Junctive puzzles.

2005-02-08 Thread Matt Fowles
All~ On Tue, 08 Feb 2005 17:51:24 +0100, Miroslav Silovic [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Well, we see the same kind of thing with standard interval arithmetic: (-1, 1) * (-1, 1) = (-1, 1) (-1, 1) ** 2 = [0, 1) The reason that junctions behave this way is

Re: Junctive puzzles.

2005-02-08 Thread Brock
On 2005.02.05.20.33, Autrijus Tang wrote: | (I've just finished the pretty printing part in Pugs, so I'll use actual | command line transcripts below. The leading ? does not denote boolean | context -- it's just telling pugs to do a big-step evaluation. Also, | boolean literals are written in

[rbw3@cse.nau.edu: Re: Junctive puzzles.]

2005-02-08 Thread Brock
Subject: Re: Junctive puzzles. User-Agent: Mutt/1.5.6+20040907i On 2005.02.05.20.33, Autrijus Tang wrote: | (I've just finished the pretty printing part in Pugs, so I'll use actual | command line transcripts below. The leading ? does not denote boolean | context -- it's just telling pugs to do

Re: [rbw3@cse.nau.edu: Re: Junctive puzzles.]

2005-02-08 Thread Matt Fowles
Brock~ On Tue, 8 Feb 2005 12:08:45 -0700, Brock [EMAIL PROTECTED] wrote: Hm. I take that back... it was a silly comment to make and not very mathematically sound. Sorry. --Brock - Forwarded message from Brock [EMAIL PROTECTED] - (a b c) == (a b) and (b c)

Re: Junctive puzzles.

2005-02-07 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: pugs ? 4 (0 | 6) 2 (#t|#f) Here's my take on it. Compare my $a = (0 | 6); say 4 $a and $a 2; vs say 4 (0 | 6) and (0 | 6) 2; The difference is that in the first case the junction refers to the same object, and the result should probably be expanded only

Re: Junctive puzzles.

2005-02-07 Thread Autrijus Tang
On Mon, Feb 07, 2005 at 05:33:06PM +0100, Miroslav Silovic wrote: my $a = (0 | 6); say 4 $a and $a 2; Yup. My mathematic intuition cannot suffer that: 4 X 2 to be true in any circumstances -- as it violates associativity. If one wants to violate associativity, one should presumably

Re: Junctive puzzles.

2005-02-07 Thread Ashley Winters
On Tue, 8 Feb 2005 11:12:40 +0800, Autrijus Tang [EMAIL PROTECTED] wrote: On Mon, Feb 07, 2005 at 05:33:06PM +0100, Miroslav Silovic wrote: my $a = (0 | 6); say 4 $a and $a 2; Yup. My mathematic intuition cannot suffer that: 4 X 2 to be true in any circumstances -- as it

Re: Junctive puzzles.

2005-02-07 Thread Larry Wall
On Tue, Feb 08, 2005 at 11:12:40AM +0800, Autrijus Tang wrote: : This way, both associativity and junctive dimensionality holds, so : I think it's the way to go. Please correct me if you see serious : flaws with this approach. Feels right to me. Larry

Junctive puzzles.

2005-02-05 Thread Autrijus Tang
(I've just finished the pretty printing part in Pugs, so I'll use actual command line transcripts below. The leading ? does not denote boolean context -- it's just telling pugs to do a big-step evaluation. Also, boolean literals are written in their Scheme forms.) In S06, the meaning of

Re: Junctive puzzles.

2005-02-05 Thread Nicholas Clark
On Sat, Feb 05, 2005 at 08:33:25PM +0800, Autrijus Tang wrote: With the note that b must be evaluated at most once. However, if taken literally, it gives this rather weird result: pugs ? 2 (0 | 3) 4 (#t|#t) Surely you can do better than that for counterintuitive? :-) 4 (0 | 6)

Re: Junctive puzzles.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 12:38:57PM +, Nicholas Clark wrote: Surely you can do better than that for counterintuitive? :-) 4 (0 | 6) 2 pugs ? 4 (0 | 6) 2 (#t|#f) Why is it so? Because: 4 (0 | 6) and (0 | 6) 2 (4 0 | 4 6) and (0 | 6) 2 # local

Re: Junctive puzzles.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 01:52:05PM +, Nicholas Clark wrote: #t and (0 | 6) 2 # reduction in boolean context(!) Why is it allowed to do this? Because and forces boolean context to determine whether it short-circuits or not. However, I should've make it clear that if

Re: Junctive puzzles.

2005-02-05 Thread Nicholas Clark
On Sat, Feb 05, 2005 at 08:43:10PM +0800, Autrijus Tang wrote: On Sat, Feb 05, 2005 at 12:38:57PM +, Nicholas Clark wrote: Surely you can do better than that for counterintuitive? :-) 4 (0 | 6) 2 pugs ? 4 (0 | 6) 2 (#t|#f) Why is it so? Because: 4 (0 | 6)

Re: Junctive puzzles.

2005-02-05 Thread Nicholas Clark
On Sat, Feb 05, 2005 at 10:04:02PM +0800, Autrijus Tang wrote: On Sat, Feb 05, 2005 at 01:52:05PM +, Nicholas Clark wrote: #t and (0 | 6) 2 # reduction in boolean context(!) Why is it allowed to do this? Because and forces boolean context to determine whether

Re: Junctive puzzles.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 02:39:26PM +, Nicholas Clark wrote: On Sat, Feb 05, 2005 at 10:04:02PM +0800, Autrijus Tang wrote: On Sat, Feb 05, 2005 at 01:52:05PM +, Nicholas Clark wrote: #t and (0 | 6) 2 # reduction in boolean context(!) Why is it

Re: Junctive puzzles.

2005-02-05 Thread Nicholas Clark
On Sun, Feb 06, 2005 at 02:30:21AM +0800, Autrijus Tang wrote: On Sat, Feb 05, 2005 at 02:39:26PM +, Nicholas Clark wrote: On Sat, Feb 05, 2005 at 10:04:02PM +0800, Autrijus Tang wrote: On Sat, Feb 05, 2005 at 01:52:05PM +, Nicholas Clark wrote: #t and (0 | 6)

Re: Junctive puzzles.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 06:35:55PM +, Nicholas Clark wrote: If junctions are sets, and so a|b is identical to b|a, then isn't it wrong for any implementation of junctions to use any short-circuiting logic in its implementation, because if it did, then any active data (such as tied things

Re: Junctive puzzles.

2005-02-05 Thread Uri Guttman
NC == Nicholas Clark [EMAIL PROTECTED] writes: NC If junctions are sets, and so a|b is identical to b|a, then isn't NC it wrong for any implementation of junctions to use any NC short-circuiting logic in its implementation, because if it did, NC then any active data (such as tied things