On Sat, 19 Feb 2005 18:42:36 +1100, [EMAIL PROTECTED] (Damian Conway) wrote:
the Awesome Power of Junctions:
As I tried to express elsehwere, this what I'm looking for.
Instinctively, and for a long time since I first came across Q::S, I thought
that the killer app of Junctions is there
Rod Adams asked:
This sound reasonable enough?
Frankly, no. ;-)
Sorry, but your latest proposal sounds complex, multiply special-cased, and
way too much of an imposition on the programmer (which is specifically what
junctions are supposed to avoid).
I'm going to continue to strongly recommend
Nigel Sandever wrote:
On Sat, 19 Feb 2005 18:42:36 +1100, [EMAIL PROTECTED] (Damian Conway) wrote:
The Awesome Power of Junctions:
As I tried to express elsehwere, this what I'm looking for.
Instinctively, and for a long time since I first came across Q::S, I thought
that the killer app of
Damian Conway wrote:
Rod Adams asked:
This sound reasonable enough?
Frankly, no. ;-)
Sorry, but your latest proposal sounds complex, multiply
special-cased, and way too much of an imposition on the programmer
(which is specifically what junctions are supposed to avoid).
Funny. I thought it was
On Sat, Feb 19, 2005 at 01:43:57PM -0800, Ashley Winters wrote:
Instead of primary sigils, what about secondary sigils on an array to
mark it as an unordered set?
@|foo = any
@foo = all
@^foo = one # can arrays be curried arguments? hmm
@!foo = none
After all, why should scalars get
On Sun, 20 Feb 2005 03:17:19 -0600, [EMAIL PROTECTED] (Rod Adams) wrote:
--020209010404060902000407
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Nigel Sandever wrote:
On Sat, 19 Feb 2005 18:42:36 +1100, [EMAIL PROTECTED] (Damian
Rod Adams [EMAIL PROTECTED] writes:
$re1 = /^ -[x]* x -[x]* $/; # match a string with exactly one
'x' in it.
$re2 = /^ -[y]* y -[y]* $/; # ditto 'y'
$re3 = /^ -[z]* z -[z]* $/; # ditto 'z'
$re7 = none($re1, $re2, $re3); # matches if there are 0 or 2+ of
each of x,y,z.
On Sun, Feb 20, 2005 at 07:41:16PM +1100, Damian Conway wrote:
Given this:
my $x = set(1..3);
my $y = set(1,3,5,7,9);
my $n = 2;
$x | $y # set(1,2,3,5,7,9)
$x $y # set(1,3)
$x - $y # set(2)
!$x #
Rod Adams [EMAIL PROTECTED] writes:
Eirik Berg Hanssen wrote:
Rod Adams [EMAIL PROTECTED] writes:
$re1 = /^ -[x]* x -[x]* $/; # match a string with exactly one
'x' in it.
$re2 = /^ -[y]* y -[y]* $/; # ditto 'y'
$re3 = /^ -[z]* z -[z]* $/; # ditto 'z'
$re7 = none($re1,
NC == Nicholas Clark [EMAIL PROTECTED] writes:
NC On Sun, Feb 20, 2005 at 07:41:16PM +1100, Damian Conway wrote:
NC Given this:
my $x = set(1..3);
my $y = set(1,3,5,7,9);
my $n = 2;
$x | $y # set(1,2,3,5,7,9)
$x $y # set(1,3)
$x - $y # set(2)
!$x
Nicholas Clark wrote:
On Sun, Feb 20, 2005 at 07:41:16PM +1100, Damian Conway wrote:
Given this:
my $x = set(1..3);
my $y = set(1,3,5,7,9);
my $n = 2;
$x | $y # set(1,2,3,5,7,9)
$x $y # set(1,3)
$x - $y # set(2)
!$x
Eirik Berg Hanssen [EMAIL PROTECTED] writes:
Rod Adams [EMAIL PROTECTED] writes:
Eirik Berg Hanssen wrote:
Rod Adams [EMAIL PROTECTED] writes:
$re1 = /^ -[x]* x -[x]* $/; # match a string with exactly one
'x' in it.
$re2 = /^ -[y]* y -[y]* $/; # ditto 'y'
$re3 = /^ -[z]* z -[z]*
On Sun, Feb 20, 2005 at 10:46:15PM +0100, Eirik Berg Hanssen wrote:
Eirik Berg Hanssen [EMAIL PROTECTED] writes:
Rod Adams [EMAIL PROTECTED] writes:
$re1 = /^ -[x]* x -[x]* $/; # match a string with exactly one 'x'
$re2 = /^ -[y]* y -[y]* $/; # ditto 'y'
$re3 = /^ -[z]* z -[z]*
Damian~
On Mon, 21 Feb 2005 08:29:40 +1100, Damian Conway [EMAIL PROTECTED] wrote:
Nicholas Clark wrote:
On Sun, Feb 20, 2005 at 07:41:16PM +1100, Damian Conway wrote:
Given this:
my $x = set(1..3);
my $y = set(1,3,5,7,9);
my $n = 2;
$x | $y
Hmm. On rereading my last message, I feel that it comes across as angry,
and critical of this entire discussion or perhaps of particular participants.
That was certainly not my intent and I apologize if that's how it appeared. I
genuinely respect the contributions of every person on this
On Fri, Feb 18, 2005 at 11:31:54PM -0800, Brent 'Dax' Royal-Gordon wrote:
Junctions are intended to ultimately be used in boolean tests. That's
why the values of the junction have an any/all/one/none relationship.
The proper data structure here is an array. (Actually, ironically
enough,
Brent 'Dax' Royal-Gordon wrote:
Rod Adams [EMAIL PROTECTED] wrote:
The caller is not in a position to know if the callee is internally
structured in such a way that passing in a raw junction makes sense.
Sure
they are. It's called reading the documentation. If it doesn't say it can
Damian Conway wrote:
Rod Adams wrote:
All I want now is for autothreading to be explicit.
It already *is*.
The only way that:
is_prime($x)
can ever autothread is if $x holds a junction. But that can now only
happen if there's an explicit Cuse junctions in scope where $x was
assigned to (or
Damian Conway wrote:
Hmm. On rereading my last message, I feel that it comes across as
angry, and critical of this entire discussion or perhaps of particular
participants.
That was certainly not my intent and I apologize if that's how it
appeared. I genuinely respect the contributions of
Rod Adams wrote:
I had not caught the difference between:
use junctions;
$x = 6|7|8;
if is_prime($x) {...}
and
if is_prime(6|7|8) {...}
There isn't one.
Is this new, or yet another important detail I missed along the way?
Or is this a side effect of not being able to store a Junction,
On Sat, 19 Feb 2005 15:20:59 -0600, Rod Adams [EMAIL PROTECTED] wrote:
Positions I still stand by:
- Sets belong in the language, and need more support. This can likely be
done at the module level, but I'd like them better incorporated,
preferably with their own sigil. However, I believe
On Sat, Feb 19, 2005 at 02:40:00PM -0600, Rod Adams wrote:
I addressed earlier concept of how does perl know when there are side
effects, particularly with the execution path can weave to parts written
in pure-parrot. Patrick responded by implying
that there was no such side effect
Rod Adams wrote:
Simply put,
I want my junctions.
Standard in Perl 6.
I want my hyper operator superstrength arrays.
Standard in Perl 6.
I want them both at the same time.
Standard in Perl 6.
I never want to see implicit threading. Ever.
If this is the only stumbling block, then it's easily
Damian Conway [EMAIL PROTECTED] wrote:
Yes, it's a side-effect of the new default prohibition on junction assignments
(though I'm still working hard to convince everyone that that prohibition
cripples junctions and that having to use junctions before you can assign a
basic Perl 6 scalar
Damian Conway wrote:
Rod Adams wrote:
I never want to see implicit threading. Ever.
If this is the only stumbling block, then it's easily solved.
Instead of ruining junctions by imposing all kinds of complex and
annoying hoops and hurdles (i.e. Cuse junctions and Cno
junctions), we can just
Rod Adams [EMAIL PROTECTED] wrote:
Larry Wall wrote:
Junctions can short circuit when they feel like it, and might in some
cases do a better job of picking the evaluation order than a human.
I was afraid someone was going to say that. And I now must convert my
reservations about junction
On Feb 18, 2005, at 2:04 AM, Brent 'Dax' Royal-Gordon wrote:
Junctions are equivalent to the English sentence Get eggs, bacon, and
toast from the store. (In Perl, that'd be something like C
$store-get(eggs bacon toast) .) It's just a bit of
orthogonality that allows you to give eggs, bacon,
Brent 'Dax' Royal-Gordon wrote:
Rod Adams [EMAIL PROTECTED] wrote:
Larry Wall wrote:
Junctions can short circuit when they feel like it, and might in some
cases do a better job of picking the evaluation order than a human.
I was afraid someone was going to say that. And I now must
Larry Wall wrote:
The need for junctions
first became evident when we found ourselves filling the ~~ tables
with various sorts of weird non-symmetries.
~~ can easily be called the DWIM compare operator. It even looks like
you're waving your hands, asking for some strange voodoo to happen. It
Rod Adams writes:
Junctions are intended to be used mainly within conditionals and other
statements;
If the set of these other statements is limited, consider creating a
Junction class (which needs a use Junction; to activate), which
overloads the various comparison operators for when a
On Fri, Feb 18, 2005 at 12:42:31PM -0600, Rod Adams wrote:
No, but nor does it have a concept quite like a variable.
Which significantly weakens the mapping naturally to human linguistic
structures argument, IMO.
Why exactly? It's just the variable-nature of variables that isn't
exactly
Luke Palmer wrote:
Rod Adams writes:
Junctions are intended to be used mainly within conditionals and other
statements;
If the set of these other statements is limited, consider creating a
Junction class (which needs a use Junction; to activate), which
overloads the various comparison
On Fri, 18 Feb 2005 12:47:51 -0700, Luke Palmer [EMAIL PROTECTED] wrote:
Run through your mind how this would be done with a junction in $x.
Particularly focus on:
2..sqrt($x)
What the hell does that mean? Do you get a junction of lists out? Or
does sqrt die because it's not
Ashley Winters [EMAIL PROTECTED] writes:
On Fri, 18 Feb 2005 12:47:51 -0700, Luke Palmer [EMAIL PROTECTED] wrote:
Run through your mind how this would be done with a junction in $x.
Particularly focus on:
2..sqrt($x)
What the hell does that mean? Do you get a junction of lists out?
On Fri, 18 Feb 2005 23:12:40 +0100, Eirik Berg Hanssen
[EMAIL PROTECTED] wrote:
Ashley Winters [EMAIL PROTECTED] writes:
On Fri, 18 Feb 2005 12:47:51 -0700, Luke Palmer [EMAIL PROTECTED] wrote:
Run through your mind how this would be done with a junction in $x.
Particularly focus on:
On Fri, 18 Feb 2005 14:35:53 -0800, Ashley Winters
[EMAIL PROTECTED] wrote:
1 .. sqrt(10) - LazyList of (1..3)
1 .. sqrt(10|20) - Junction of any(1,2,3, 1,2,3,4)
LazyList does Iterator, but Junction does not. You'd have to use (1 ..
sqrt(3|6)).values to iterate through the possible values
Hmmm... It seems that this way does lie madness -- there's a fundamental
ambiguity between autothreading happening inside or outside the declared
loop, and there's no least surprising way to implement it. Certainly
inside the loop is the easiest and most natural to implement, but that acts
Craig DeForest wrote:
Hmmm... It seems that this way does lie madness -- there's a fundamental
ambiguity between autothreading happening inside or outside the declared
loop, and there's no least surprising way to implement it. Certainly
inside the loop is the easiest and most natural to
Rod Adams [EMAIL PROTECTED] wrote:
if $x == 3|4|5|6 {...}
would thread over infix:== without any funkiness, since we'll assume
operators are well written, and can take junctions as parameters, same as:
if is_prime(3|4|5|6) {...}
Would pass the junction to is_prime, to
Rod Adams [EMAIL PROTECTED] wrote:
Luke Palmer wrote:
2..sqrt($x)
What the hell does that mean? Do you get a junction of lists out? Or
does sqrt die because it's not expecting a junction?
What on earth does C for (2..sqrt(3|5)) {...} mean in the current
state of junctions?
In
Brent 'Dax' Royal-Gordon wrote:
Rod Adams [EMAIL PROTECTED] wrote:
Luke Palmer wrote:
2..sqrt($x)
What the hell does that mean? Do you get a junction of lists out? Or
does sqrt die because it's not expecting a junction?
What on earth does C for (2..sqrt(3|5)) {...} mean in the
Brent 'Dax' Royal-Gordon wrote:
Rod Adams [EMAIL PROTECTED] wrote:
if $x == 3|4|5|6 {...}
would thread over infix:== without any funkiness, since we'll assume
operators are well written, and can take junctions as parameters, same as:
if is_prime(3|4|5|6) {...}
Would pass the
Rod Adams [EMAIL PROTECTED] wrote:
Suppose funky_test is a derivative of C printf . Only this printf let's
you feed it a junction for the format, and it will sort through them and see
which one matches best depending on actual number of parameters, parameter
types, etc. Ordinarily, this would
Rod Adams wrote:
All I want now is for autothreading to be explicit.
It already *is*.
The only way that:
is_prime($x)
can ever autothread is if $x holds a junction. But that can now only happen if
there's an explicit Cuse junctions in scope where $x was assigned to (or the
explicit use
Brent 'Dax' Royal-Gordon wrote:
Rod Adams [EMAIL PROTECTED] wrote:
Larry Wall wrote:
That, and we'd like a novice to be able to write
given $x {
when 1 | 2 | 3 {...}
when 4 | 5 | 6 {...}
}
Or just change Cwhen to accept a list of things to compare against,
followed by a
On Thu, Feb 17, 2005 at 02:18:55AM -0600, Rod Adams wrote:
: The simple if is:
:
: if $x ~~ (1,2,3,4) {...} # parens needed here since , is lower than ~~
: in precedence.
That is asking if $x is a list containing 1,2,3,4.
: Same for unless/while/until. And all of this from the entirely useful
On Thu, Feb 17, 2005 at 09:06:47AM -0800, Larry Wall wrote:
Junctions can short circuit when they feel like it, and might in some
cases do a better job of picking the evaluation order than a human.
Hmm, yes, there is an interesting interaction with lazy
evaluation ranges here.
$x = any( 1
Larry Wall wrote:
On Thu, Feb 17, 2005 at 02:18:55AM -0600, Rod Adams wrote:
: The simple if is:
:
: if $x ~~ (1,2,3,4) {...} # parens needed here since , is lower than ~~
: in precedence.
That is asking if $x is a list containing 1,2,3,4.
Quoting S04:
$_ $xType of Match
Jonathan Scott Duff [EMAIL PROTECTED] writes:
On Wed, Feb 16, 2005 at 12:17:35PM +1100, Damian Conway wrote:
none($a, $a) == undef
True.
Isn't this one false in the case when $a is undef?
Since it is numerical comparison, it is false as long as $a == 0.
(I would hope.)
Eirik
--
So
On Wed, 16 Feb 2005 12:17:35 +1100, [EMAIL PROTECTED] (Damian Conway) wrote:
..values tells you what raw values are inside the junction. The other kind of
introspection that's desirable is: what raw values can *match* this
junction. There would probably be a .states method for that.
To
On Wed, Feb 16, 2005 at 01:06:22PM +, Nigel Sandever wrote:
Any chance that you could provide one or two simple but realistic examples of
using Junctions and their operators?
I'll give it a shot, but keep in mind that I'm somewhat new to this
also. :-)
First, junctions are an easy way
On Wed, 16 Feb 2005 09:18:42 -0600, [EMAIL PROTECTED] (Patrick R. Michaud)
wrote:
On Wed, Feb 16, 2005 at 01:06:22PM +, Nigel Sandever wrote:
Any chance that you could provide one or two simple but realistic examples
of
using Junctions and their operators?
I'll give it a shot,
On Wed, Feb 16, 2005 at 06:04:37PM +, Nigel Sandever wrote:
On Wed, 16 Feb 2005 09:18:42 -0600, [EMAIL PROTECTED] (Patrick R. Michaud)
wrote:
And for fun, try writing the equivalent of
if $x == one($a, $b, $c, $d) { ... }
without a junction. (Okay, one can cheat with Cgrep.)
On Wed, Feb 16, 2005 at 01:55:31PM -0600, Patrick R. Michaud wrote:
: And to
: anticipate the followup question of Well, why not make features such
: as junctions into optional modules?, I think a partial answer is that
: features like these really need deep language support to work
: effectively
Patrick R. Michaud wrote:
On Wed, Feb 16, 2005 at 06:04:37PM +, Nigel Sandever wrote:
If the hyper operator returned one boolean result for each
comparison it made, and if a list of boolean values in a
boolean context collapsed to a count of the trues/1s it contained,
I think those would
Larry Wall wrote:
That, and we'd like a novice to be able to write
given $x {
when 1 | 2 | 3 {...}
when 4 | 5 | 6 {...}
}
Or just change Cwhen to accept a list of things to compare against,
followed by a coderef.
-- Rod Adams
On Wed, 16 Feb 2005 14:29:14 -0600, Rod Adams [EMAIL PROTECTED] wrote:
Larry Wall wrote:
That, and we'd like a novice to be able to write
given $x {
when 1 | 2 | 3 {...}
when 4 | 5 | 6 {...}
}
Or just change Cwhen to accept a list of things to compare against,
Okay, so we've established that:
$x = any(3,4,5);
@l = $x.values.sort;
Leaves us with @l == (3,4,5), and that makes a fair amount of sense.
What do the following evaluate to:
@l1 = all(3,4,5).values.sort;
@l2 = one(3,4,5).values.sort;
@l3 = none(3,4,5).values.sort;
@l4 =
Rod Adams wrote:
Okay, so we've established that:
$x = any(3,4,5);
@l = $x.values.sort;
Leaves us with @l == (3,4,5), and that makes a fair amount of sense.
What do the following evaluate to:
@l1 = all(3,4,5).values.sort;
Same.
@l2 = one(3,4,5).values.sort;
Same.
@l3 = none(3,4,5).values.sort;
On Wed, Feb 16, 2005 at 12:17:35PM +1100, Damian Conway wrote:
none($a, $a) == undef
True.
Isn't this one false in the case when $a is undef?
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
Jonathan Scott Duff wrote:
none($a, $a) == undef
True.
Isn't this one false in the case when $a is undef?
Yes. Apologies for not being more precise.
Damian
On Wed, Feb 16, 2005 at 12:17:35PM +1100, Damian Conway wrote:
Rod Adams wrote:
On a slightly different topic, do the following equivalences work:
[...]
none($a, $a) == undef
True.
Scott already caught (and Damian acknowledged) this one, it's false
if $a == undef.
none($a,$a,$b) ==
Damian Conway wrote:
.values tells you what raw values are inside the junction. The other
kind of introspection that's desirable is: what raw values can
*match* this junction. There would probably be a .states method for
that.
To see the difference between the two, consider:
my $ideal_partner
Patrick R. Michaud wrote:
none(none($a,$b),none($c,$d)) == none($a,$b,$c,$d)
True.
H...
- none(none($a,$b) == none($a,$b,$c,$d),
none($c,$d) == none($a,$b,$c,$d))
- none(none($a == none($a,$b,$c,$d),
$b == none($a,$b,$c,$d)),
none($c ==
Patrick R. Michaud wrote:
none(none($a,$b),none($c,$d)) == none($a,$b,$c,$d)
True.
H...
- none(none($a,$b) == none($a,$b,$c,$d),
none($c,$d) == none($a,$b,$c,$d))
RHS distributes first. So the expansion is this instead...
- none(none(none($a,$b),none($c,$d)) == $a,
On Wed, Feb 16, 2005 at 02:53:15PM +1100, Damian Conway wrote:
Patrick R. Michaud wrote:
none(none($a,$b),none($c,$d)) == none($a,$b,$c,$d)
True.
H...
- none(none($a,$b) == none($a,$b,$c,$d),
none($c,$d) == none($a,$b,$c,$d))
RHS distributes first. So the
Patrick R. Michaud wrote:
RHS distributes first. So the expansion is this instead...
Ummm, okay, but that's not what I interpreted from S09, where
it says that the left-most conjunction or injunction is
autothreaded first. In this I've also assumed that
$a == $b
is equivalent to
67 matches
Mail list logo