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