Re: [Dev-luatex] Example: Sorting in LuaTeX
Hello,
yesterday I experimented a little with \directlua, and I decided to code a sorting routine, since sorting in TeX (as i.e. implemented in the experimental LaTeX 3 code or in Bernd Raichle's paper "Sorting in TeX's mouth") is quite slow.
Yes, excellent example and nicely emphasizing my comment during Taco's talk in San Diego: "Doing [list processing] in TeX is great for your ego,
I concur. It is a great feeling when you finally found an elegant (well, relatively elegant, we're talking about TeX's macro language) way of implementing a macro. BTW: Is there a transcript of the video available? The video itself is a little bit too large for me (and possibly others) to download. Also, I find it easier to read a text than to listen to a talk. Faster, too.
but..."
No buts! ;-)
In any case: Imagine the possibilities when using Lua not only for manipulating the node list, but also for parsing user input!
Using lua to parse user input is convenient, think of key=val processing which is currently jumping through hoops to remove spaces and the correct number of braces etc.
Yes, but until LuaTeX is out of beta and widespread, it will be necessary to keep an implementation in TeX. So unless it really speeds things up, or makes better error handling possible, I do not see much use in parsing user input in Lua. Or am I forgetting something? Jonathan
Jonathan Sauer wrote:
Yes, but until LuaTeX is out of beta and widespread, it will be necessary to keep an implementation in TeX. So unless it really speeds things up, or makes better error handling possible, I do not see much use in parsing user input in Lua.
Or am I forgetting something?
Parsing user input which contains tex is kind of tricky anyway, for instance on needs to deal with braces, special characters (catcodes) etc that need to be fed back into tex (i.e. value of key stored in macro) bar={\foo{oeps $some math$}} also the overhead may be a bit larger than normal (tex is not that slow). It all depends on how downward compatible one wants to be. For special tasks it makes sense to do key/val parsing in lua, for others tex has to do the job (given that one has to operate within a certain macro package) 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 -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Jonathan Sauer