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( (1..100

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 $^x}

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: Patrick is right on the money here...as usual. (Don't you just

Re: S04

2005-02-10 Thread Aaron Sherman
On Thu, 2005-02-10 at 11:59, Luke Palmer wrote: > There's been some discussion about bringing a syntax back for that > recently, but I haven't really been paying attention. Anyway, this is > pretty clear: > > loop { > $foo = readline; > do { stuff :with($foo) }; > las

Re: Perl 6 Summary for 2005-01-31 through 2004-02-8

2005-02-10 Thread Larry Wall
On Thu, Feb 10, 2005 at 12:32:21PM +0100, Miroslav Silovic wrote: : [EMAIL PROTECTED] wrote: : : >>i think so but i can't read larry's mind (nor would i want to! :) : >> : >>XP = extreme programming : >>DBC = design by contract (or even designed by conway :) : >>MP = ?? : > : > : >Modu

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 C was a boolean operator. But I could be very wro

Re: S04

2005-02-10 Thread Larry Wall
On Thu, Feb 10, 2005 at 07:39:54AM -0800, David Storrs wrote: : Given that Perl 6 won't support an actual do-while loop a la C++ (and : yes, I know that Perl5 didn't either), how would you accomplish that? : That is, I'd like to have a loop that runs once, then checks its : condition to see if it s

Re: S04

2005-02-10 Thread Luke Palmer
David Storrs writes: > Given that Perl 6 won't support an actual do-while loop a la C++ (and > yes, I know that Perl5 didn't either), how would you accomplish that? > That is, I'd like to have a loop that runs once, then checks its > condition to see if it should repeat and continues to repeat as l

Re: S04

2005-02-10 Thread David Storrs
Given that Perl 6 won't support an actual do-while loop a la C++ (and yes, I know that Perl5 didn't either), how would you accomplish that? That is, I'd like to have a loop that runs once, then checks its condition to see if it should repeat and continues to repeat as long as the condition is true.

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 wro

Re: Perl 6 Summary for 2005-01-31 through 2004-02-8

2005-02-10 Thread Michele Dondi
On Thu, 10 Feb 2005, Miroslav Silovic wrote: Modular Programming David I think it's Metaprogramming. :) The only thing that sprung to my mind was "MetaPost"... Michele -- No one can ever predict all of the possible error conditions, of course; as soon as we write idiot-proof code, along comes a bet

Re: Perl 6 Summary for 2005-01-31 through 2004-02-8

2005-02-10 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: i think so but i can't read larry's mind (nor would i want to! :) XP = extreme programming DBC = design by contract (or even designed by conway :) MP = ?? Modular Programming David I think it's Metaprogramming. :) Miro

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 f

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 a Partial ordering relations are also transitive by definition. Of course, you can overload '<' to be something other than orde

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 junc

Re: = vs <== [was: Perl 6 Summary for 2005-01-31 through 2004-02-8]

2005-02-10 Thread David Landgren
Aaron Sherman wrote: So hold on to your socks... what about: @x @y; This reminds me of AWK's string concatenation behaviour: print "this " $1 " that " $2 This was nice feature at the time, but caused problems down the track when they wanted to add functions to the language in a subsequen

Re: Perl 6 Summary for 2005-01-31 through 2004-02-8

2005-02-10 Thread David Landgren
Uri Guttman wrote: [...] i think so but i can't read larry's mind (nor would i want to! :) XP = extreme programming DBC = design by contract (or even designed by conway :) MP = ?? Modular Programming David

Re: Perl 6 Summary for 2005-01-31 through 2004-02-8

2005-02-10 Thread Markus Laire
John Macdonald wrote: The basic problem is that a junction does not work well with boolean operations, because the answer is usually "sometimes yes and sometimes no" and until you resolve which of those is the one you want, you have to proceed with both conditions. Well, just patch the boolean oper

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 is_prime($x)

Re: Perl 6 Summary for 2005-01-31 through 2004-02-8

2005-02-10 Thread Uri Guttman
> "MD" == Michele Dondi <[EMAIL PROTECTED]> writes: MD> On Wed, 9 Feb 2005, Larry Wall wrote: >> roadblocks thrown in their way. That's true not only for LP, but >> also for FP, MP, XP, AOP, DBC, and hopefully several other varieties MD> ^^ ^^^ MD> ^

Re: Perl 6 Summary for 2005-01-31 through 2004-02-8

2005-02-10 Thread Michele Dondi
On Wed, 9 Feb 2005, Larry Wall wrote: roadblocks thrown in their way. That's true not only for LP, but also for FP, MP, XP, AOP, DBC, and hopefully several other varieties ^^ ^^^ ^^ ^^^ 1. 2. Ehmmm... sorry for the ignorance, but... 1. Fu