Re: Micro-articles on Perl 6 Operators

2007-09-19 Thread David Vergin

> On 9/18/07, Paul Hodges <[EMAIL PROTECTED]> wrote:
>> 
>> For the Gearheads
>>   We won't bore you with excess details,
>>   but for more info... c.f. ...
>> 

on 9/19/2007 10:19 AM Adriano Ferreira said the following:
> I am thinking about such hooks and good ways to do that.

As an eager reader of these articles, I would find such hooks quite helpful.

How about a standard section near the end of each article:


Going Deeper:
   For info on a trick with (@x, *) to extend a list, see...
   To learn how to use @@() for multidimensional context, see...


Regards,
dvergin


Re: Micro-articles on Perl 6 Operators

2007-09-19 Thread Adriano Ferreira
On 9/19/07, Moritz Lenz <[EMAIL PROTECTED]> wrote:
> Adriano Ferreira wrote:
> > http://ferreira.nfshost.com/perl6/stitching6.html
>
> A grammatical nit: "The infix operator '~' keeps the same precedence of
> '+' in Perl 6."
> I think that should be "the same precedence _as_" (but I'm not a native
> speaker, so forgive me if I'm wrong ;-))

I will trust you. It kind of sounds better.

> Anyway, a nice article again.
>
> Cheers,
> Moritz
>
> --
> Moritz Lenz
> http://moritz.faui2k3.org/ |  http://perl-6.de/
>
>
>


Re: Micro-articles on Perl 6 Operators

2007-09-19 Thread Adriano Ferreira
On 9/18/07, Joe Gottman <[EMAIL PROTECTED]> wrote:
> Adriano Ferreira wrote:
> > I salute every bit of help. I am trying to organize the production and
> > will hopefully provide more details soon. By now, I think that I can
> > handle suggestions and corrections to the articles. The next one is
> > here:
> >
> > http://ferreira.nfshost.com/perl6/stitching6.html
> >
> >
>This one's very nice.  One question: what's the "~+" operator you
> talk about in your discussion of prefix ~ ?  I can't find any mention of
> it in Synopsis 3.

Like Larry pointed, I got it wrong. I replaced this with the bitwise
or for strings '~|' which was basically what I intended from the
beginning.

> Joe Gottman


Re: Micro-articles on Perl 6 Operators

2007-09-19 Thread Adriano Ferreira
On 9/18/07, Paul Hodges <[EMAIL PROTECTED]> wrote:
>
> Looks good . . . but how short do we want them?

Very short. The usual length that an IT-savvy guy (with at least some
curiosity on programming languages) reads in a glimpse instead of
going somewhere else looking for shorter or more immediate
information.

We could write a treatise on Perl 6 operators (and that will be long
and fascinating for some), but that's not the goal right now.

> For the non-Perl audience, I think it might be worth mentioning the
>  (to us) obvious automatic context manipulations. e.g.,
>
>  ~ is "stitching" strings, and will make strings out of its arguments
> if it can -- it's not adding, but has the same precedence, so:
>   $x =  1 ~  2  + 3;  # 15: is "12" + 3, string coerced to number
>
> maybe even add
>   $y = (1 ~  2) + 3;  # 15: same as above, but explicit
>   $z =  1 ~ (2  + 3); # 15: 1 ~ 5, numbers coerced to strings
> though I think that adds up to a bit too much clutter.

"adds too much clutter" - that's the cutting point. If adds that much,
leave it (at least this time).

> Or have I gone too long without sleep? It looks funny

It is indeed. But mixing string and numeric operations is perlishly
weird -- it scares little children and find good use in rare places
IMO.

> The point is that we want these articles to play up both the old
> "perlishness" that's retained for those fearful of change, and give a
> good feel of what "perlishness" is all about to those used to C and
> Java...or CoBOL and ForTran. We also want shell programmers to see that
> the convenience factor of quick scripting is still there, but with
> Perl's ramped-up capabilities -- it beats the hell out of ksh and awk,
> after all, but isn't really so much harder to learn and use, either at
> the low or the high end.
>
> Maybe we should add a "Making the easy things easy, and the hard things
> possible" tagline to all these articles. :)

There are newer taglines for Perl 6, but I could not find them right now.

I prefer not to stick those mottos in the series to not enforce even
more the (hopefully) effect of the articles as advertising of the
language.

> Also -- is it out of the scope of these to have each perhaps present a
> basic problem and a use of the operator to solve it? I think the zip
> article does that, and the example helped, but this one seems like a
> small but faintly operator-spicy example would help, even if a little
> contrived.
>
>   sub page_ruler ( uint8 $len = 80 ) { # take int, max 256, default 80
>   my $ruler = '';  # declares a buffer
>   my $digit = 0;   # starts with 0
>   $ruler ~= $digit++ % 10  # appends next digit
>  while length($ruler) < $len;  # till there's enough
>   return $ruler;   # and returns the string
>   }
>   my $r = page_ruler(25); # 0123456789012345678901234

I think small examples are a good idea. The problem is to have much
simpler ways to do some things, like

  [~] map { $_ % 10 }, 0 ..^ $len

Obviously, this is far from didactical in this moment.

> Again, PLEASE double-check my probably goofy syntax.
>
> Paul
>
> --- Adriano Ferreira <[EMAIL PROTECTED]> wrote:
>
> > On 9/18/07, Paul Hodges <[EMAIL PROTECTED]> wrote:
> > >
> > > --- Adriano Ferreira <[EMAIL PROTECTED]> wrote:
> > > [[snips here and at end]]
> > > > > . . . I have one suggestion: you might want to mention
> > > > > the roundrobin function in the article on the zip function
> > since
> > > > > the two are very closely related.
> > > >
> > > > Thanks, Joe and Alberto.
> > > >
> > > > Even though the roundrobin is very closely related to zip, I
> > think
> > > > that mentioning it and giving an explanation would add length and
> > > > detail to the article. I already sacrificed the trick with (@x,
> > *) to
> > > > extend a list and the @@() for multidimensional context, which
> > are
> > > > fine but too much for this piece of text.
> > >
> > > It would certainly add length, but you could minimize the addition
> > of
> > > detail by using them as hooks. Maybe embed them in a special
> > section...
> > > e.g.,
> > >
> > > 
> > > For the Gearheads
> > >
> > >   We won't bore you with excess details, but for more info on the
> > trick
> > >   with (@x, *) to extend a list and the @@() for multidimensional
> > >   context, c.f. .
> > > 
> >
> > I am thinking about such hooks and good ways to do that. More on that
> > later.
> >
> > > Sorry, not sure where to link off the top of my head, but if anyone
> > > thinks it's a good idea I'll look it up on request.
> > >
> > > > Well, it's kind of hard to keep these articles small and
> > interesting.
> > > > Maybe this stuff can find their way in later articles.
> > >
> > > Personally, I'm a bit behind on my P6, but I think this is a good
> > idea.
> > >
> > > I'd be happy to contribute something, and though my time is short
> > like
> > > everyone's these days, please feel free to contact me here

Re: Micro-articles on Perl 6 Operators

2007-09-19 Thread Adriano Ferreira
On 9/18/07, David Vergin <[EMAIL PROTECTED]> wrote:
>  > On 9/18/07, Paul Hodges <[EMAIL PROTECTED]> wrote:
>  >> 
>  >> For the Gearheads
>  >>   We won't bore you with excess details,
>  >>   but for more info... c.f. ...
>  >> 
>
> on 9/19/2007 10:19 AM Adriano Ferreira said the following:
>  > I am thinking about such hooks and good ways to do that.
>
> As an eager reader of these articles, I would find such hooks quite helpful.
>
> How about a standard section near the end of each article:
>
> 
> Going Deeper:
> For info on a trick with (@x, *) to extend a list, see...
> To learn how to use @@() for multidimensional context, see...
> 

Sounds like a good idea.

Stumbling blocks:

* (@x, *) does not work in current implementations
* it's a very good idea that I learn more Perl 6
* Gotta get those operators articles out

By the way, the article on ~ was published:

http://www.oreillynet.com/onlamp/blog/2007/09/yap6_operator_stitching.html

> Regards,
> dvergin
>


Re: Micro-articles on Perl 6 Operators

2007-09-19 Thread Paul Hodges

--- Larry Wall <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 18, 2007 at 07:41:54PM -0700, Paul Hodges wrote:
> :  while length($ruler) < $len;  # till there's enough
> 
> There is no length function anymore.

duh. I knew that. Still thinking in v5.
Thanks, Larry.


   

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC