ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm <texml@fiee.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: final thoughts on experiments with lua
Date: Thu, 10 Jan 2019 08:03:45 +0100	[thread overview]
Message-ID: <E5C7FD25-7D6D-4518-B62E-0BB87ADB2B20@fiee.net> (raw)
In-Reply-To: <1129b579-cbdc-a34d-4e25-9c4c9ecf87d8@uni-bonn.de>

Am 2019-01-09 um 20:57 schrieb Thomas A. Schmitz <thomas.schmitz@uni-bonn.de>:

> I've finished testing my lua script, and it does exactly what I need. I think I'll write a small article about it for one of the next context group proceedings,

Hi Thomas, since I’m just starting to work on the current CG journal (sorry, life happens...), I might fit your article in.
And a German version would be welcome for DANTE’s DTK.

> 3. Lua's handling of tables is very efficient and fast. For analyzing my Greek texts, I have to use huge tables for morphological parsing, with more than 900,000 entries. Looking up words in these tables is around 3x faster in Lua than in python!

Nice to know. Maybe I should try to convert some of my Python code (esp. the ConTeXt related scripts)...

> One final thought: one limitation that I still find cumbersome to work around is the fact that associative arrays ("pairs" in Lua speak) do not have an order. When I analyze my texts, I want book numbers, chapters, paragraphs preserved in the order in which they are read (entered into the table). In many cases, it is not possible (or extremely awkward) to sort these numbers, since chapters may be numbered something like 2, 2a, 3, 3α, 3β etc. python has the OrderedDict() in its collections module. In Lua, the best I could find was entering the chapter numbers into an array (ipair) and then retrieve it from there. Maybe there is a better way?

Since Python’s usual dict is also unordered, I guess OrderedDict also just uses an index array under the hood.
Python makes it easy to create new classes (also data types) that behave like something known. Don’t know how that would look in Lua...

Python’s batteries are much bigger than Lua(TeX)’s. Of course Lua should be kept small, but there are always things missing.
My Lua library for invoices with ConTeXt e.g. uses an object model from an obscure Lua library. Probably it would make more sense to use Lua’s tables in a native way than to insist on objects. I also missed a good GUI library (with widgets); I chose tekui and added some GUI-from-configuration stuff, but got stuck, since I’m comfortable with my CLI scripts anyway...


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD


___________________________________________________________________________________
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
___________________________________________________________________________________

      parent reply	other threads:[~2019-01-10  7:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09 19:57 Thomas A. Schmitz
2019-01-09 20:12 ` luigi scarso
2019-01-09 20:38 ` Alan Braslau
2019-01-10  0:09   ` Hans Hagen
2019-01-10  0:08 ` Hans Hagen
2019-01-10  9:27   ` Schmitz Thomas A.
2019-01-10  9:50     ` luigi scarso
2019-01-10 11:11       ` Henning Hraban Ramm
2019-01-10 12:09         ` Hans Hagen
2019-01-10 14:53         ` luigi scarso
2019-01-10  7:03 ` Henning Hraban Ramm [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E5C7FD25-7D6D-4518-B62E-0BB87ADB2B20@fiee.net \
    --to=texml@fiee.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).