Many thanks - it is the perverse ideas I am interested in - when I find it
hard to justify devoting time to coding original solutions rather than
translations.
Regards
_John Sampson_
On 31/01/2011 18:47, Steve Wampler wrote:
[snip]
> And, just because I'm feeling perverse today, you can express the
> 'pattern' as a one-liner using co-expressions!:
> --------------------------------------------------------------
> procedure main()
>
> # construct a 'pattern' matching "foo" and "baz" separated
> # exactly one character (produces the matched substring)
>
> pat := create (tab(upto('f')), (="foo"||move(1)||="baz"))
>
> # Try it out:
> "foo baz bar" ? write(@^pat)
>
> "bar foo baz foo@baz" ? {
> if @^pat then write("match found")
> else write("no match")
> }
>
> "bar foo:baz a foo?baz" ? {
> while write(@^pat)
> }
>
> end
> -----------------------------------------------
> (There's subtle performance hit with this approach, since
> the co-expression has to be refreshed all the time...)
>
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group