Hi,

I uploaded a new version that mostly concerns documentation files (checking them for lmtx and so). I (partly) updated the primitives manual (for hans vd meer) and added followingup-expressions (for pablo).

The expressions stuff (was already in previous uploads) is a side effect of finalizing some luametatex code. Part of it had been there in commented form as I had not yet made up my mind about how much is needed. In the end I decided to *not* integrate it in the \numexpr an d\dimexpr primitives because of potential compatibility issues (although that is unlikely given the way we use them in the core, I don't know to what extend users use these primitives). The long ago - one of the first things in luametatex - introtroduced integer division : probably went unnoticed (of course not by ws) which is an indication that this extension has been is rather safe.

Anyway, more about expressions can be found in the mentioned documents. Think of (one can of course also use the usual tex variables):

\starttext

\the\dimexpression 2 * 10pt + 2pt \relax

\the\dimexpression 2 * 10pt > 2pt \relax

\number\dimexpression 2 * 10pt + 2pt \relax

\number\dimexpression 2 * 10pt > 2pt \relax

\ifboolean\dimexpression 2 * 10pt > 2pt \relax yes \else nop \fi

\ifboolean\dimexpression 2 * 10sp > 2pt \relax yes \else nop \fi

\ifdimexpression 2 * 10pt > 2pt \relax yes \else nop \fi

\ifdimexpression 2 * 10sp > 2pt \relax yes \else nop \fi

% alias \ifexpression :

\ifnumexpression (2 * 10) + (3 << 4) > (4 & 5)  \relax yes \else no \fi

\stoptext

Performance wise it is comparable to \dimexpr and \numexpr (these are a bit faster in luametatex than in luatex), the final \relax is mandate (so no lookahead side effects), and these don't suffer from some of the somewhat weird properties of their ancestors. The main difference is that they support comparison and bitwise operators. I can add more but it probably doesn't make sense. With

\tracingexpressions1 \tracingonline1

you get info like this:

1:4: {dimenexpression rpn: 2 655360 * 131072 +}
1:4: {dimenexpression rpn: 2 655360 * 131072 >}
1:4: {dimenexpression rpn: 2 655360 * 131072 +}
1:4: {dimenexpression rpn: 2 655360 * 131072 >}
1:4: {dimenexpression rpn: 2 655360 * 131072 >}
1:4: {dimenexpression rpn: 2 2 * 131072 >}
1:4: {dimenexpression rpn: 2 655360 * 131072 >}
1:4: {dimenexpression rpn: 2 2 * 131072 >}
1:4: {numexpression rpn: 2 10 * 3 4 << + 4 5 band >}

Of course (maybe for sure) there can be bugs but then, only a few will ever use this (I bet hvdm is one of them, as he also uses the other new \if* features).

Other hidden 'pearls' (bachotex speak) will be revealed in due time,

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to