Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Article Poll

What is your favorite operator from Perl 6?
  • unary _, string context (4)
  • binary ~~, logical xor (7)
  • unary *, list contex (6)
  • unary ^, vector ops (19)
  • unary :=, binding (15)
  • unary //, logical 'default' operator (39)
  • (You may not vote anonymously. Please log in.)
    [ Results | Polls ]
    Comments:4 | Votes:90

    Exegesis 3 Posted

    posted by pudge on 2001.10.05 16:15   Printer-friendly
    Trey writes "For all those wanting to see Apocalypse 3 in action, Damian has written Exegesis 3."

    Excellent. Now if I can only finish reading Apocalypse 3 ... DARN YOU SPACE-TIME CONTINUUM! DARN YOU TO HECK!

    The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
     Full
     Abbreviated
     Hidden
    More | Login | Reply
    Loading... please wait.
    • When all is said and done, when I we going to see a working beta of perl6? Is this 6 months away, 2 years away... any timeframe at all? If you had to guess?
      • When all is said and done, when I we going to see a working beta of perl6?

        You mean: apart from the one in my head that I use to write the Exegeses? ;-)

        My best guess would be about 12 months from now, though there might well be alphas for parts of the language within six months.

        Damian
    • Is the
      my ($name, $vers, $status, $costs) = ;
      ability to return only 4 scalars available for normal functions?
      eg wantarray returning 4 ?
    • Damian gives the example code
        sub mean (*@values : $type //= 'arithmetic') {
                      given ($type) {
                              when 'arithmetic': { return sum(@values) / @values; }
                              when 'geometric': { return product(@values) ** (1/@values) }
                       
      --

      --
      Trey Harris
      Secretary, The System Administrators Guild [sage.org]
      • Would you be able to write
        mean arithmetic:@vals
        or would you have to write
        mean 'arithmetic':@vals?


        Neither, I'm afraid. Since the @values parameter is on the left and the $type parameter is on the right, you'd write:

        mean @values : 'arithmetic'

        And, no, there's no autoquoting, unless you explicitly specify it:

        sub mean (*@values : $type is stringified //= 'arithmetic') {

        (and Larry hasn't signed of on such a parameter trait yet either)
        • Ah, then clearly more than meets the eye is going on with your print examples. Can one put an adverb anywhere in the parameter list when declaring a subroutine, or only at the end? I notice that the empty adverb list is used in

                  print : ($x * $y) * $z;

          in order to effect the old print +(...), ...; behavior.

          Or I think I do.... Surely the filehandle (empty in this case) is an initial adverb and the direct objects are the parameters. But if adverbs are only permitted at th
          --

          --
          Trey Harris
          Secretary, The System Administrators Guild [sage.org]
          • ...clearly more than meets the eye is going on with your print examples... So what does print's signature look like?

            It has two (that's going to be common in Perl 6).

            One is colonic:

            print ( $filehandle //= $*OUT : *@list )

            The other is not:

            print ( *@list )

            So, in the colonic version (we have to find a better adjective!), it's the values to be printed that are conceptually the adverbs.

            Like I've said elsewhere though: the use of post-colonic parameters as adverbs is merely a way of thinking about
            • Like I've said elsewhere though: the use of post-colonic parameters as adverbs is merely a way of thinking about them.

              I got it. Thanks!

              [print] has two (that's going to be common in Perl 6).

              One is colonic:

                            print ( $filehandle //= $*OUT : *@list )

              The other is not:

                            print ( *@list )


              How would I refer to these? Is 100% of the signature required, or just some disambiguating portion?

                 
              --

              --
              Trey Harris
              Secretary, The System Administrators Guild [sage.org]
              • How would I refer to these? Is 100% of the signature required, or just some disambiguating portion?

                Probably just the type-and-number components of the signature, with the parameter names optional (and ignored). So any of:

                        temp &myprint := &print($filehandle : *@list);
                        temp &myprint := &print($foobar : *@baz);
                        temp &myprint := &print($:*@);

    • Shouldn't my ($name, $vers, $status, $costs, @and_the_rest) = <$fh>;
      be written as my ($name, $vers, $status, $costs, *@and_the_rest) = <$fh>;

      Or am I totally off ?? - Just wondering...

      • Or am I totally off ??

        You're totally off. ;-)

        The slurpative asterisk is only needed in parameter lists or the lvalues of a := binding operation.

        Plain ol' assignment in Perl6 remains exactly the same as plain ol' assignment in Perl 5.