txr-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Txr-users] Experimental: horizontal functions.


From: Kaz Kylheku
Subject: [Txr-users] Experimental: horizontal functions.
Date: Tue, 08 Nov 2011 22:07:50 -0800
User-agent: Roundcube Webmail/0.4


Hi all,

New feature in repository: horizontal matching functions.

If you write a function like this

 @(define fun (x y))material here@(end)

It is a horizontal function, which is useful for character-oriented extraction across a line.


Simple example: function that extract a sequence of digits:

 @(define num (out))@{out /[0-9]/+}@(end)

Now use it:

 Age: @(num age)

"Age: " is matched, then (num age) matches a number, and binds it to age.



Recursion works, check out how TXR cleans up the bracket matching task:

http://rosettacode.org/wiki/Balanced_brackets#TXR


Cheers ...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]