Re: simultaneous conditions in junctions

2009-04-01 Thread Martin D Kealey
On Wed, 1 Apr 2009, John Macdonald wrote: > If I understand correctly, (which is by no means assured) a function > call with a junction as an argument generally acts as if it were > autothreaded. So: > > $x = any(1,2,3); > $y = f($x); > > should work like: > > $y = any( f(1),

Re: [Fwd: Re: junctions and conditionals]

2009-04-01 Thread Martin D Kealey
On Wed, 1 Apr 2009, Richard Hainsworth wrote: > A closer examination of Martin's message indicates that he tends to think > that hitting a junction ought to thread the entire program throughout the > rest of the lifespan of said junction Yes -- and well put, thank-you. The trick is that since con

Re: junctions and conditionals

2009-04-01 Thread Martin Kealey
On Tue, 31 Mar 2009, Jon Lang wrote: > Another issue: what happens if conditional code mutates a junction > that it filtered? For example: > > $x = any (-5 .. 5); > if $x > 0 { $x++ }; > > At this point, which of the following does $x equal? > > any(-4 .. 6) # the original junction get

Re: junctions and conditionals

2009-04-01 Thread Dave Whipp
Mark J. Reed wrote: [I] wrote: So I'd vote for going with simple semantics that are easy to explain -- that is, don't attempt implicit junctional collapse. Provide operators to collapse when needed, but don't attempt to be too clever. While it's easier to find clever programmers than to write

Re: simultaneous conditions in junctions

2009-04-01 Thread Larry Wall
On Wed, Apr 01, 2009 at 08:40:12AM -0700, Dave Whipp wrote: > That said, the semantics of a chained relop really should work correctly > for this. If you only reference a junction once in an expression, then > it should behave as such: {a

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread Larry Wall
On Tue, Mar 31, 2009 at 10:54:33PM -0700, Jon Lang wrote: : * Why are pointy blocks forbidden from enclosing their signatures in : parentheses, or from using the ":( ... )" notation? Is this a : holdover from the early days, when parentheses denoted a list? Or is : there still a good reason not t

Re: junctions and conditionals

2009-04-01 Thread Mark J. Reed
On Wed, Apr 1, 2009 at 11:49 AM, Dave Whipp wrote: > The problem I see with this (other than implementation issues) is that it > would lead to unintuitive behavior in some cases: > > my $x = one(10,20); > if $x > 15 { > # here, $x collapsed to "20" > if $x > 5 { say "$x > 5" } else { say "not $

Re: simultaneous conditions in junctions

2009-04-01 Thread TSa
HaloO, John Macdonald wrote: Unless autothreading is also implied by conditionals, $y and $z would have significantly different results; $y === any(undef,undef,undef) while $z === any(1,2,3). This is why I'm opting for statical analysis of auto-threaded conditionals. But, if autothreading

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread TSa
HaloO, Moritz Lenz wrote: * What types are you allowed to assign to an invocant? Whatever the type constraint says. When you write class Foo { method bar ($x, $y) }, then bar's signature gets an invocant of type Foo implicitly. If you write ... method bar (A $s:, $x, $y), then the type constra

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread Patrick R. Michaud
On Wed, Apr 01, 2009 at 09:55:37AM -0300, Daniel Ruoso wrote: > Em Qua, 2009-04-01 às 05:41 -0700, Jon Lang escreveu: > > ...nor would I expect it to. I'm just wondering if (@_, %_) _are_ > > still part of a placeholder-generated signature. In short, is there a > > way to access a slurpy array or

Re: junctions and conditionals

2009-04-01 Thread Dave Whipp
Jon Lang wrote: [proposal that conditional statements should collapse junctions] $x = +1 | -1; if $x > 0 { say "$x is positive." } else { say "$x is negative." } I suspect that both codeblocks would be executed; but within the first block, $x == +1, and within the second codeblock,

Re: [Fwd: Re: junctions and conditionals]

2009-04-01 Thread TSa
HaloO, Richard Hainsworth wrote: ( $a <= any(-1,+1) && any(-1,+1) <= $b )(*A) [..] $tmp = any(-1,+1); $a <= $tmp && $tmp <= $b (*B*) Quite how the lines I have labelled (A) and (*B*) are different, I do not understand. Unless wrapping a junctio

Re: junctions and conditionals

2009-04-01 Thread TSa
HaloO, Jon Lang wrote: Another issue: what happens if conditional code mutates a junction that it filtered? For example: $x = any (-5 .. 5); if $x > 0 { $x++ }; At this point, which of the following does $x equal? any(-4 .. 6) # the original junction gets mutated any(-5 .. 0,

Re: simultaneous conditions in junctions

2009-04-01 Thread Dave Whipp
Richard Hainsworth wrote: Thinking about Jon Lang's -1|+1 example in another way, I wondered about simultaneous conditions. Consider $x = any (1,2,5,6) How do we compose a conditional that asks if any of this set of eigenstates are simultaneously both > 2 and < 5? Clearly the desired answer

Re: simultaneous conditions in junctions

2009-04-01 Thread John Macdonald
On Wed, Apr 01, 2009 at 09:44:43AM -0400, Mark J. Reed wrote: > The idea is that junctions should usually be invisible to the code, > and autothreading handles them behind the scenes. [ ... ] If I understand correctly, (which is by no means assured) a function call with a junction as an argument

r26042 - docs/Perl6/Spec

2009-04-01 Thread pugs-commits
Author: moritz Date: 2009-04-01 16:03:18 +0200 (Wed, 01 Apr 2009) New Revision: 26042 Modified: docs/Perl6/Spec/S04-control.pod Log: [S04] fixed illegal construct, sbp++ Modified: docs/Perl6/Spec/S04-control.pod === --- docs/Perl6

Re: simultaneous conditions in junctions

2009-04-01 Thread Mark J. Reed
The idea is that junctions should usually be invisible to the code, and autothreading handles them behind the scenes. Once you start using the eigenstates as a collection, you're breaking the model and not gaining anything over just using a regular collection type. But the "behind the scenes"

Re: [Fwd: Re: junctions and conditionals]

2009-04-01 Thread Henry Baragar
On Wednesday, April 01 2009 07:38 am, Richard Hainsworth wrote: > Right now, yes.  I'm arguing that the way that they're designed to > work doesn't DWIM.  Try a slightly different example: > >     0 <= $x <= 1 # 0 is less than $x is less than 1. >     $x ~~ 0..1 # $x is in the range of 0 to 1. > >

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread Daniel Ruoso
Em Qua, 2009-04-01 às 05:41 -0700, Jon Lang escreveu: > On Wed, Apr 1, 2009 at 5:07 AM, Daniel Ruoso wrote: > > The concept of "invocant" only exists in terms of syntax now. In runtime > > the invocant is simply the first positional argument. This simplifies > > things a lot. > I think you're conf

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread Jon Lang
On Wed, Apr 1, 2009 at 5:07 AM, Daniel Ruoso wrote: > Em Ter, 2009-03-31 às 22:54 -0700, Jon Lang escreveu: >> Yes, I know that there is no S08.  I'm working on writing one, and I'd >> like some feedback to help me do so. > > ++ > >> My draft is going to be about Signatures and Captures.  Thus, my

Re: simultaneous conditions in junctions

2009-04-01 Thread Jon Lang
On Wed, Apr 1, 2009 at 12:58 AM, Richard Hainsworth wrote: > Thinking about Jon Lang's -1|+1 example in another way, I wondered about > simultaneous conditions. > > Consider > > $x = any (1,2,5,6) > > How do we compose a conditional that asks if any of this set of eigenstates > are simultaneously

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread Daniel Ruoso
Em Ter, 2009-03-31 às 22:54 -0700, Jon Lang escreveu: > Yes, I know that there is no S08. I'm working on writing one, and I'd > like some feedback to help me do so. ++ > My draft is going to be about Signatures and Captures. Thus, my questions: > Invocants: The concept of "invocant" only exist

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread Jon Lang
Jonathan Worthington wrote: > Jon Lang wrote: >> >> Invocants: >> >> * Does anyone object to roles having an invocant, and that invocant >> referring to the class that is doing the role? >> >> > > Yes; on further reflection, the ability to type that invocant raises all > kinds of possible WTFs with

[Fwd: Re: junctions and conditionals]

2009-04-01 Thread Richard Hainsworth
This email was mistakenly not sent to the p6l list. Jon writes: On Wed, Apr 1, 2009 at 12:54 AM, Richard Hainsworth wrote: Jon Lang wrote: In "Junction Algebra", Martin Kealey wrote: On Mon, 30 Mar 2009, Mark J. Reed wrote: ( $a <= any(-1,+1) <= $b ) == ( $a <= any(-1,+1) && a

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread Jonathan Worthington
Jon Lang wrote: Invocants: * Is it illegal to specify an invocant in a sub, or is it merely nonsensical? That is, should the compiler complain, or should it silently treat the invocant as the first positional parameter? (The latter has the advantage that you don't have to worry about what the

Re: simultaneous conditions in junctions

2009-04-01 Thread Carl Mäsak
Richard (>): > Consider > > $x = any (1,2,5,6) > > How do we compose a conditional that asks if any of this set of eigenstates > are simultaneously both > 2 and < 5? > Clearly the desired answer for $x is False, but > > my $x = any(1,2,5,6); say ?( 2 < $x < 5); # true > > Is there some combination

simultaneous conditions in junctions

2009-04-01 Thread Richard Hainsworth
Thinking about Jon Lang's -1|+1 example in another way, I wondered about simultaneous conditions. Consider $x = any (1,2,5,6) How do we compose a conditional that asks if any of this set of eigenstates are simultaneously both > 2 and < 5? Clearly the desired answer for $x is False, but my $

Re: S08 Draft questions (Captures and Signatures)

2009-04-01 Thread Moritz Lenz
I can't comment on most of your questions, but the few that I can answer are inline below... Jon Lang wrote: > Yes, I know that there is no S08. I'm working on writing one, ++ > * What types are you allowed to assign to an invocant? Whatever the type constraint says. When you write class Foo