Re: idiom for iterating

Chris Babcock <[email protected]> Wed, 22 Apr 2009 12:42:34 -0700
Newsgroups gmane.mail.spam.crm114
Organization Kolonel Panic
Message-ID <[email protected]>
On Wed, 22 Apr 2009 20:50:45 +0200
Thomas Michael Hagen <[email protected]> wrote:

> >> there must be a better way than duplicating all that code, right?  
> >
> > Try "match [:file:] (::) /^/" before going into your loop.

> thanks! your way of doing it looks like it should work; matching the
> whole thing *including* the starting tag first, and then separating
> out the start tag later.

So the place in the code where part of your opening marker was included
in the match... was in the match that originally assigned the value to
the variable:

----------------------------------------------

[usak@cl-t090-563cl bin]$ cat ./test.crm
#!/usr/bin/crm
window
input [test.data] (:data:)
match [:data:] (:context:) /[[:print:]]+/
{
match <fromnext> [:context:] (:focus:) /../
output /Next 2 are: :*:focus:\n/
liaf
}
output /\nSource was: \n:*:data:/

[usak@cl-t090-563cl bin]$ ./test.crm
Next 2 are: bc
Next 2 are: cd
Next 2 are: de
Next 2 are: ef
Next 2 are: fg

Source was:
abcdefg

----------------------------------------------

That's probably not a desirable behavior. ;-)

At least it's consistent with different variable creation methods. I
didn't test it exhaustively, but the behavior is the same with "input"
so it is likely to be the same no matter how the variable is created.

Chris

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p

_______________________________________________
Crm114-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crm114-general
signature.asc (application/pgp-signature, 489 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEcBAEBAgAGBQJJ73MqAAoJEASgqNsqZfCH0z0IAJ7mqA7ZQNnP8BvM/eQTNpqw
DGD3Be1nXBk/uoi+TsXGW6uEXhQ6fwhDcM5UKu9kJzcpGO3yT3txZvZJ4adxcQsB
hZAgyyQnXKuEWoaSoJ2W5xUWyhy2vfHAJ4XvPahtkcMtXb1xTn2Uvu1t/4O0burX
GdiqU8Xshe86LOKPc0T75ItpqoF89sgJtwGXhuGaR2xIBWgEjsfXchdNj7eCxmak
xXd/H7vFKfZiQLQ5pW3PTyJsb5sR+W9bvymmunNx2G8GjNbcfN9mw4PFq8xec5TE
hXx3QwzahMMr2UlMeGjEzHiIynqi2H8+Fmuit2kjIYOQrLH7A7zQCON15CtgIMw=
=Q0Kr
-----END PGP SIGNATURE-----