148 reputation
4
bio website
location
age
visits member for 2 years, 4 months
seen Apr 30 at 5:30

Aug
7
comment What is the difference between Fragile and Robust commands?
I get the impression that \def\arg{#1}\ifx\arg\empty E\else F\fi (which doesn't compile) was intended to be a test of whether the argument passed to \arg was empty or not, and produce T if it is and F if it isn't...but I'm not aware of a way to use either \if or \ifx to do that, I would use \ifthenelse from the ifthen package, i.e. \def\isargempty#1{\ifthenelse{\equal{#1}{}}{T}{F}}.
Jul
27
comment Command /k unavailable in encoding OT1. - possibly using too many languages in one document?
@Tzigi Welcome to the site...if your question is answered, it's best to click the check mark next to the best answer, and upvote that answer plus any others that helped.
Jul
27
awarded  Scholar
Jul
27
accepted Implementing car and cdr in TeX
Jul
27
revised Implementing car and cdr in TeX
minor typo
Jul
26
awarded  Supporter
Jul
26
comment Implementing car and cdr in TeX
After testing it a bit, it looks like this solution seems to throw away white-space tokens without counting them, rather than stopping, e.g. \cdr{ f o o } returns o o , throwing away the leading spaces without counting them as tokens. That could ruin it for some applications, but not for what I have in mind immediately, as the text I'm parsing never uses whitespace as a meaningful delimiter.
Jul
26
comment Implementing car and cdr in TeX
Thanks, I think this solution will work...it occurs to me that with \car we clearly don't need to evaluate anything else once we know that the first token isn't a macro, and for \cdr, as long as we're throwing away a non-macro token, lazy evaluation of the rest should give the same result. So if the expansion stops early it shouldn't be a problem, as long as it leaves a non-macro token at the start.
Jul
26
awarded  Editor
Jul
26
comment Implementing car and cdr in TeX
@JosephWright Thanks, edited to reflect that \@car and \@cdr come from LaTeX.
Jul
26
revised Implementing car and cdr in TeX
fix to reflect that \@car and \@cdr come from LaTeX
Jul
26
comment Implementing car and cdr in TeX
Thanks, that's a bit of a step in the right direction...but I still don't think it's sufficient to make car and cdr safe when used in macros that call other macros and built up lists of unevaluated tokens that eventually come to include nested calls to \@car or @cdr. There's no way, for example, to use \expandafter in defining \car and \cdr to make both \car{\cdr{foo}} and \car{\cdr{\cdr{foo}}} work, as \car would need to use different numbers of \expandafters before calling \@car...it's fine if we know exactly what tokens are coming before hand, but not safe in the general case.
Jul
26
comment Implementing car and cdr in TeX
@Yiannis I link to that article, and give the definitions found there in my question, please read more carefully.
Jul
26
awarded  Student
Jul
26
asked Implementing car and cdr in TeX