Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] variant-replace

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] variant-replace


Chronological Thread 
  • From: Henri Lesourd <address@hidden>
  • To: Armin Straub <address@hidden>
  • Cc: address@hidden
  • Subject: Re: [TeXmacs] variant-replace
  • Date: Wed, 22 Mar 2006 13:14:52 +0100

Armin Straub wrote:

Hi,

I have found the Scheme macro variant-replace in tm-circulate.scm. Now I wonder how to rewrite this macro in order to handle arity other than one.


It seems that there's no tm-circulate.scm file
anymore in 1.0.6. But (variant-replace) still
exists, it is now stored in edit/variants.scm.

We have :
[[
(tm-define (variant-replace which by)
(with-innermost t which
(tree-assign-node t by)))
]]

As far as I can see, (variant-replace tag1 tag2) looks
for the innermost tree having the label tag1, and replaces
this label by tag2.

For achieving the same result with one more parameter,
you should replace (variant-replace) by something
like :
[[
(tm-define (variant-replace-2 tag1 tag2 lab)
(with-innermost t tag1
(if (>= (tree-arity t) 1)
(path-assign (tree->path t)
(tree tag2 (tree-ref t 0) lab)))))
]]

(the list of available path/tree primitives can be
found in build-glue-editor.scm).

Best, Henri



  • variant-replace, Armin Straub, 03/22/2006
    • Re: [TeXmacs] variant-replace, Henri Lesourd, 03/22/2006

Archive powered by MHonArc 2.6.19.

Top of Page