Re: RFC 197 (v1) Numeric Value Ranges In Regular Expressions

2000-09-22 Thread David L. Nicol

Hugo wrote:
 
 In [EMAIL PROTECTED], "David L. Nicol" writes:
 :I think I did -- I guess v2 didn't make it in; I sent it again; what
 :were your and mjd's comments again?
 
 Here are the messages:
 http://www.mail-archive.com/perl6-language-regex%40perl.org/msg00306.html
 http://www.mail-archive.com/perl6-language-regex%40perl.org/msg00294.html
 
 However if you didn't see them it is too late now, since I see that
 your v2 freezes the RFC. I think it is a shame there was not more
 discussion of this - I'm sure the functionality would be useful, but
 I'm not at all convinced about the syntax.
 
 Hugo



Thanks.  Yes, I had seen them, and they are both valid criticisms.  There
are more examples in v2.

The syntax matches exactly the syntax used for specifying segments of number line
in algebra classes.

If this goes into the language, people who are writing nonlinear number systems
would have to decide whether to support it or not and if so how; that goes w/o saying

the inspiration for it, along with its companion piece on an implied grep in certain
hash accesses, is a way to ease slicing of "traditional" multidimensional arrays.   


%Center_of_4x4x4_cube = %FourCube{/[2,3] [2,3] [2,3]/} ;


That's an old-fasioned fake multidimensional array, of course, not one of these
new creatures.




-- 
  David Nicol 816.235.1187 [EMAIL PROTECTED]
   "The most powerful force in the universe is gossip"



special character to match a valid expression

2000-09-11 Thread David L. Nicol



Thinking about the brace matching problem, regarding the specific
problem of writing a regex to match any valid specification of
a scalar written like 

${expression returning name or reference goes here}

I realized that no amount of lookahead is going to be without possible
problems.

So why not give up and try another direction?  A special backslash
assertion that matches ___ a valid perl expression which appears as if
it would return a value ___ would be just the thing.

We could call it \v for valid, and it would match as far as it could get
in validity.

($Name_Of_The_First_Interpolable_Scalar) = m/\$(\w+|(\{\v\}))/;


It's opposite, \V, is something I'd like to know more about before submitting
a RFC on this idea.  Would it be greedy?  Would it require a quantifier, matching
dot for that many, and then validate the results?  Maybe it should be left undefined:
can anyone come up with a situation in which you'd want to match all the characters
that were not syntactically valid, or match up to the last token that would match all
the previous brackets?


-- 
  David Nicol 816.235.1187 [EMAIL PROTECTED]
   perl -e'map{sleep print$w[rand@w]}@w=' ~/nsmail/Inbox



Re: XML/HTML-specific ? and ? operators? (was Re: RFC 145 (alternate approach))

2000-09-07 Thread David L. Nicol

Bart Lateur wrote:
 
 On 06 Sep 2000 18:04:18 -0700, Randal L. Schwartz wrote:
 
 I think the -1 indexing for "end of array" came from there.  Or at
 least, it was in Perl long before it was in Python, and it was in Icon
 before it was in Perl, so I had always presumed Larry had seen Icon.
 Larry?


I thought he got it from the substr function in CDC mainframe BASIC, which
in which negative positions mean "from the end of the string"



Re: RFC 145 (alternate approach)

2000-09-05 Thread David L. Nicol

David Corbin wrote:

  I've got some vague ideas on solving all of these, I'll go into if
  people like the basic concept enough.

not just in regexes, but in general, a way to extend the set of bratches
that Perl knows about would be very nice.  for instance it is very difficult
for people using european keyboards to produce curlies; if it was possible to
say that Q is the opening brace and it matches against q later, or any arbitrary
characters, such as the single-character versions of  and  which I am not
capable of producing, if it was possible to specify this in the code somewhere
for instance 

$CORE::BRATCH{'Q'} = 'q';

(or maybe lexically scoped)

after that one could say 

$isafromline = qrQ^Fromq;

for instance.


-- 
  David Nicol 816.235.1187 [EMAIL PROTECTED]
   perl -e'@w=;for(;;){sleep print[rand@w]}' /usr/dict/words



Re: RFC 110 (v2) counting matches

2000-08-29 Thread David L. Nicol

Mark-Jason Dominus wrote:
 
 It occurs to me that since none of the capital letters are taken, we
 could adopt the convention that a capital letter as a regex modifier
 will introduce a *word* which continues up to the next comma. 


Excelsior!


-- 
  David Nicol 816.235.1187 [EMAIL PROTECTED]
   Yum, sidewalk eggs!



Re: RFC 158 (v1) Regular Expression Special Variables

2000-08-25 Thread David L. Nicol

Tom Christiansen wrote:

 There's also long been talk/thought about making $ and $1
 and friends magic aliases into the original string, which would
 save that cost.


I was distressed to discover that s///g does not rebuild the
old string between matches, but only at the end.  It broke my
random anagram generator which was depending on instant updates.


If STRING was a linked list of partially full blocks rather than
a big piece of contiguous space, we could do length-altering substitutions
without copying.

-- 
  David Nicol 816.235.1187 [EMAIL PROTECTED]
   safety first: Republicans for Nader in 2000