ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Lvalue Str::words iterator
by Ingo Blechschmidt other posts by this author
Jun 15 2005 10:15AM messages near this date
Re: PATCH: S04 - unary C<=> is not slurpy | Re: Lvalue Str::words iterator
Hi,

as Larry mentioned in another thread that he wants a "different notation
for word
splitting" (http://www.nntp.perl.org/group/perl.perl6.language/21874),
how about that, similar to Haskell's "words" function:

    # Str::words should return a list of words, without whitespace.
    my $str   = " hi   my name is  ingo  ";
    my @words = words $str;
    say join ",", @words;     # "hi,my,name,is,ingo";


    # The list returned should contain lvalueable objects (idea courtesy
    # of wolverian):
    my $str     = " hi   my name is  ingo  ";
    $str.words .= map:{ ucfirst };
    say $str;                 # " Hi   My Name Is  Ingo  "
    # Note: The whitespace was preserved!


Comments?


--Ingo

-- 
Linux, the choice of a GNU | We are Pentium of Borg. Division is futile.
generation on a dual AMD   | You will be approximated.  
Athlon!                    | 
Thread:
Ingo Blechschmidt
Juerd
Ingo Blechschmidt
Juerd
Larry Wall
Ingo Blechschmidt
Juerd

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved