Re: Fast expanding macros /Was: How to declare recursive factorial function?
- From: mpg <mpg@xxxxxxxxxx>
- Date: Sat, 15 Mar 2008 00:11:33 +0100
Le (on) vendredi 14 mars 2008 21:47, Ulrich Diez a écrit (wrote) :
There is plenty of stuff where expansion is not suppressed inOk. I realise I wasn't so clear about my question. Actually, it was about
order to obtain arguments, values or whatever.
E.g., expansion takes place when looking for opening-braces or
key-words related to things like register-assignments or
\unexpanded or \scantokens, with those \if-comparisons, with
\csname, with \the, when gathering a numerical value, at some
places within alignments...
when we can use those tricks (however, I didn't knew the whole list, for
example I'd never thought to things like \toks0 or \unexpanded, so thanks
for all this ideas). So, perhaps more clearly stated, the question is:
Given a macro that works purely by expansion, is there always a way to make
it deliver its result in only two expansion steps (that is, with only 3
\expandafter)? If no, what are the limits?
For some obscure reason I like \romannumeral.Wow. Frankly, I wasn't sure this was possible. I'll have to study your code
This can also be used for argument-list-iterating.
below carefuly.
E.g., create an iterator for the list which besides the listThis is it. I missed that point.
takes some arguments used for action after recursion.
Let the iterator modify these arguments during iteration...
e.g. \iterate{foo}{elem1,elem2,...}
next step: \iterate{baz}{elem2,...}
...while not delivering any token "outside" the iterator's
"argument-grabbing-range".
At the end of the recursion, have the iterator return theI'll have to read this carefuly in your code too, because it isn't that
modified argument.
clear to me...
But comma-list-parsing is poorly implemented (e.g., no lead-and-No matter, that's not exactly the point here.
trail-space-checking, also no check for a missing comma at the
end of the list.)
Actually I don't like comma-lists all too much any more andHmm, I think I agree with you. I always have a bad time thinking about these
prefer "argument-lists" wherever possible because with comma-
lists you always need to decide upon the treatment of "edge-
cases", e.g. consecutive commas, trailing-comma, leading-comma,
only blank-stuff between comma, how many levels of brace-
stripping, catcode-change of comma, ...
problems (esp. the trailing coma at end) when manipulating coma-separated
lists. I wonder why I didn't switch to argument-list more often...
If you are interested in such stuff, have a look at theUnfortunetaly, I've got a 404 code right now with this address. Hope it is
TeX pearl divers site at http://www-stary.gust.org.pl/pearls/
(-> Pearls 2005 -> David Kastrup: Iterating with roman numeral).
only a temprary errer.
I also learned a lot when Robin Fairbairns pointed me to theThanks for the hint. I saw that a while ago, but wasn't quite ready for all
'Around the bend'-department at
http://www.ctan.org/tex-archive/info/aro-bend/.
There you find the text-files exercise.001 - exercise.018
and answer.001 - answer.018.
the exercises. Maybe I'll have another look at it now.
\documentclass{article}
\makeatletter
By the way, I'll probably need some time to read your code. Maybe I'll come
up with a few question in some time...
Thanks for all your explanations !
Manuel.
.
- Follow-Ups:
- References:
- How to declare recursive factorial function?
- From: Spectrum (Claus Appel)
- Re: How to declare recursive factorial function?
- From: Ulrich Diez
- Re: Fast expanding macros /Was: How to declare recursive factorial function?
- From: mpg
- Re: Fast expanding macros /Was: How to declare recursive factorial function?
- From: Ulrich Diez
- How to declare recursive factorial function?
- Prev by Date: Re: Problem using natbib
- Next by Date: Re: Fast expanding macros /Was: How to declare recursive factorial function?
- Previous by thread: Re: Fast expanding macros /Was: How to declare recursive factorial function?
- Next by thread: Re: Fast expanding macros /Was: How to declare recursive factorial function?
- Index(es):
Relevant Pages
|