[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] el - an interactive shell-friendly form of Lua
- From: Hisham <h@...>
- Date: Tue, 30 Nov 2021 12:56:38 -0300
On Wed, 24 Nov 2021 at 14:46, Michal Kottman <michal.kottman@gmail.com> wrote:
>
> Nice to see you back on the List!
>
> On Wed, Nov 24, 2021, 17:21 steve donovan <steve.j.donovan@gmail.com> wrote:
>>
>> It is meant for people who remember the Lua standard library more than
>> the more obscure utilities, like 'cut' etc. For what we might call
>> 'personal automation' :) It is also a very expressive calculator...
>
>
> I once toyed with a slightly related idea - I had a series of nontrivial formulas and wanted to see how the output reacts to changing inputs. It was unfortunately more than 2 inputs so "graphing it in Excel" was out of the question. But the interactivity of Excel left me wondering, if something like this can be implemented as a REPL with Lua formulas.
>
> The base idea was to (ab)use metatables with __[new]index on _G to construct an AST on the fly from the formula being entered, with two "types" - var{} and exp{...}, and store their values as a "snapshot" that gets re-evaluated with all dependent exp-s at every input. So basically you could say 'a = 1; b = sin(a*math.pi); c=math.sqrt(b)' and later on every time you change 'a' you can also see 'b' and 'c' changing simultaneously. Unfortunately due to the way Lua is implemented, comparisons (<, ==, ~=) can't be "virtualized", but this was enough for my case.
LuaGravity implemented something like this, it was a project made by
Francisco Sant'Anna's in his MSc thesis!
http://www.ceu-lang.org/chico/luagravity/
cool demo: https://www.youtube.com/watch?v=-_EIWe2CFRQ