mailing-list for TeXmacs Users

Text archives Help


how can I write infix operators with arbitrary many args with xmacros


Chronological Thread 
  • From: Immanuel Normann <address@hidden>
  • To: address@hidden
  • Subject: how can I write infix operators with arbitrary many args with xmacros
  • Date: Fri, 02 Feb 2007 09:55:55 +0100

Hello,

I would like to have a convenient generic macro (or xmacro) that takes one argument representig an infix operator and arbitrary many successive arguments representing the operands of tht operator; e.g.:

<generic-infix-macro|+|4|2|5> should expand to "4+2+5"

I know the TeXmacs help page on "Macro primitives" where a very similiar example of application is given:

<assign|comma-extra|<macro|x|, <arg|x>>>

<assign|comma-separated|
<xmacro|args|
<concat<arg|args|0>
<map-args|comma-extra|concat|args|1>>>>>

Where <comma-separate|a|b|c> expands to "a,b,c"

However this example unfortunately does not solve my problem, since you can't pass "comma-separated" the "comma" as argument (representing the infix operator in this case).
And it is very awkward to write always two macros in the pattern of "comma-extra" and "comma-separated" for every infix operator. And one needs infix operators with arbitrary operands quite often.

Cheers,
Immanuel

begin:vcard
fn:Immanuel Normann
n:;Immanuel Normann
email;internet:address@hidden
tel;work:+49 421 200 3168
tel;fax:+49 421 200 3103
x-mozilla-html:TRUE
version:2.1
end:vcard




Archive powered by MHonArc 2.6.19.

Top of page