mailing-list for TeXmacs Users

Text archives Help


[TeXmacs] why is <with|> so beastly?


Chronological Thread 
  • From: Sam Liddicott <address@hidden>
  • To: address@hidden
  • Subject: [TeXmacs] why is <with|> so beastly?
  • Date: Mon, 21 May 2012 08:18:39 +0100

What can I do to a <with|> block to evaluate it immediately?

Here is a perfectly sound LOOKING macro:

<assign|join-args|<xmacro|x|<with|join|<macro|i|n|<if|<equal|<arg|n>|1>|<arg|i>|<merge|<value|joiner>|<arg|i>>>>|joiner|<arg|x|0>|<map-args|join|merge|x|1>>>>

the first argument is used to join all remaining arguments, unless there is only one, in which case it is returned. Somewhat like perl's join, except that the join is done using "merge" so the the result can be used as an identifier.

However the result returned is a <with|> tag, which cannot be subject to further merging:

although <join-args|-|b-c> renders as b-c
<merge|a|<join-args|-|b|c>> gives: <error|bad merge>
and <get-label|<join-args|-|b-c>> gives: with

So I try messing about with some quasi unquote tricks:

<assign|join-args|<xmacro|x|<quasi|<unquote|<with|join|<macro|i|n|<merge|<value|joiner>|<arg|i>>>|joiner|<arg|x|0>|<map-args|join|merge|x|1>>>>>>

to see if I can get rid of the <with|> by evaluating earlier, but it doesn't work.

<quasiquote|<merge|a|<unquote|<join-args|-|b|c>>>>
and
<quasi|<merge|a|<unquote|<join-args|-|b|c>>>>

both give: <error|bad merge>

This is not the first time that <with|> has given me trouble by hanging around too long. At times, for hacks, I've used <assign|> to a global var and been glad the macro has not been re-entrant or recursive.

In other cases for a work-around I have resorted to functional programming tricks and use of <compound|> to construct the name of the macro to call, but here I really need <with|> in order to pass the join-character to the map-args macro, and because the map-args macro must be a macro name and not a literal macro - otherwise I would have tried quasiquote to construct that macro.

So what can I do to a <with|> block to evaluate it immediately?

Sam


  • [TeXmacs] why is <with|> so beastly?, Sam Liddicott, 05/21/2012

Archive powered by MHonArc 2.6.19.

Top of page