Slurpy nullary vs nonslurpy nullary

2005-02-18 Thread Autrijus Tang
After getting Life and Mandel to run on Pugs yesterday (see http://svn.perl.org/perl6/pugs/trunk/examples/ ), today I've made this version of Quicksort to run: use v6; multi sub quicksort ( ) { () } multi sub quicksort ( *$x, [EMAIL PROTECTED] ) { my @pre = @xs.grep{ $_ $x

Re: Junction Values

2005-02-18 Thread Brent 'Dax' Royal-Gordon
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

Re: Slurpy nullary vs nonslurpy nullary

2005-02-18 Thread Larry Wall
On Fri, Feb 18, 2005 at 04:25:49PM +0800, Autrijus Tang wrote: : After getting Life and Mandel to run on Pugs yesterday (see : http://svn.perl.org/perl6/pugs/trunk/examples/ ), today I've : made this version of Quicksort to run: : : use v6; : : multi sub quicksort ( ) { () } : :

Re: Slurpy nullary vs nonslurpy nullary

2005-02-18 Thread Autrijus Tang
On Fri, Feb 18, 2005 at 08:26:26AM -0800, Larry Wall wrote: Just as a BTW, that syntax is illegal currently, since those curlies would be interpreted as hash subscripts. Noted. Which reminds me I need to implement hashes... :) : It sort of makes sense to me. Please correct me if it's wrong.

Re: Junction Values

2005-02-18 Thread David Wheeler
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,

Re: Junction Values

2005-02-18 Thread Rod Adams
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

Re: Junction Values

2005-02-18 Thread Rod Adams
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

Re: Junction Values

2005-02-18 Thread Luke Palmer
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

Re: Fun with junctions (was Sets vs Junctions)

2005-02-18 Thread Damian Conway
Thomas Sandlaß wrote: class Source[Language ::To] is Str { multi sub *coerce:as (Any $data, To ::Lang) { return Lang.serialize($data) } } What is the return type of *coerce:as? Sorry, I was too lazy (well, I'd claim I was thinking at a much higher level, but

Re: Junction Values

2005-02-18 Thread Jonathan Scott Duff
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

Re: Junction Values

2005-02-18 Thread Rod Adams
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

Re: Junction Values

2005-02-18 Thread Ashley Winters
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

Re: Junction Values

2005-02-18 Thread Eirik Berg Hanssen
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?

Re: Junction Values

2005-02-18 Thread Ashley Winters
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:

Re: Junction Values

2005-02-18 Thread Ashley Winters
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

Re: Junction Values

2005-02-18 Thread Craig DeForest
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

Re: Junction Values

2005-02-18 Thread Rod Adams
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

Re: Junction Values

2005-02-18 Thread Brent 'Dax' Royal-Gordon
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

Re: Junction Values

2005-02-18 Thread Brent 'Dax' Royal-Gordon
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

Re: Junction Values

2005-02-18 Thread Rod Adams
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

Re: Junction Values

2005-02-18 Thread Rod Adams
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

Re: Junction Values

2005-02-18 Thread Brent 'Dax' Royal-Gordon
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

Re: Junction Values

2005-02-18 Thread Damian Conway
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