On 20-3-2010 20:11, Wolfgang Schuster wrote:
Am 20.03.10 18:49, schrieb Hans Hagen:
\chardef\d!pt\plusone \chardef\d!pc\plusone \chardef\d!in\plusone \chardef\d!bp\plusone \chardef\d!cm\plusone \chardef\d!mm\plusone \chardef\d!dd\plusone \chardef\d!cc\plusone \chardef\d!sp\plusone \chardef\d!ex\plusone \chardef\d!em\plusone
\def\test@@ifdimunt#1% {\ifcsname d!#1\endcsname \donetrue \else \donefalse \fi}
\testfeatureonce{100000}{\ifdimen{34cm}{}{}}
10% faster ... anyhow, quite ugly code And I thought you show us a Lua solution. i'll have a look at why the normal one fails \doifdimensionelse expects a dimension or a number but not characters.
\starttext
\doifdimensionelse{12pt}{yes}{no} % works
\doifdimensionelse{0}{yes}{no} % works
\doifdimensionelse{}{yes}{no} % fails
\doifdimensionelse{`a}{yes}{no} % works
\doifdimensionelse{a}{yes}{no} % fails
\stoptext
i can bring the tex version (different approach btw) down to 0.625 seconds while a lua variant does 1.310 seconds Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------