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
Ingo Blechschmidt skribis 2005-06-15 19:14 (+0200):
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:
words is wrong for something that
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-06-15 19:14 (+0200):
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:
words is wrong
Ingo Blechschmidt skribis 2005-06-15 20:18 (+0200):
say join ,, @words; # hi,my,name,is,ingo;
Following the logic that .words returns the words, the words are no
longer individual words when joined on comma instead of whitespace...
sorry, I don't quite get that.
foo bar
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-06-15 20:18 (+0200):
say join ,, @words; # hi,my,name,is,ingo;
Following the logic that .words returns the words, the words are no
longer individual words when joined on comma instead of
whitespace...
sorry, I don't quite get that.
Ingo Blechschmidt skribis 2005-06-15 21:35 (+0200):
So maybe we should allow words() (or however we'll end up calling it) to
take an optional parameter specifying what's considered a wordchar,
with a default of rx/\w+/:
Then isn't making \w+ the default for match much easier?
(Although I
Y'all are getting hung up on the correspondence of words with word
characters, but you're ignoring the fact that most of the time people
want to do awk's version of splitting, matching \S+ words rather than \w+
words (*neither* of which actually matches what people usually mean
by words, in any