[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: mathlib
- From: Sean Conner <sean@...>
- Date: Mon, 7 Apr 2014 17:12:55 -0400
It was thus said that the Great Christopher Berardi once stated:
> On Apr 7, 2014 12:57 PM, "steve donovan" <steve.j.donovan@gmail.com> wrote:
> >
> > On Mon, Apr 7, 2014 at 6:43 PM, Christopher Berardi
> > <cberardi32@gmail.com> wrote:
> > > I would like to see a comprehensive (3rd party) math library for Lua,
> one
> > > that could be used for a wide variety of mathematical disciplines
> instead.
> >
> > Well, there's lhf's lmathx, binds the extra C99 functions. Then
> > things get ... complicated, because people have different mathematical
> > needs.
>
> Getting a common and useful subset for a sizable userbase is the tricky
> part. Or, fill a niche market. My areas of interest are not the same as
> other peoples which are different yet again from some else. But a stab at
> it may give me something to do.
>
> > > I'll also put myself with those who want a more robust and expressive
> > > require function.
> >
> > But precisely what does this mean?
>
> For one example of expressiveness, and I know its been beaten to death
> before, would be akin to Python's import statement:
> import module1
> import module2 as m2
> import module3, module4
> from module5 import func1, func2
> ...
I think I've mentioned this before, but why not extend the programming
editor you use to do the expansion for you? I can certainly extend my
editor such that I highlight
module5 func1 func2 func3
and have it (the editor) generate:
local module5 = require "module5"
local func1 = module5.func1
local func2 = module5.func2
local func3 = module5.func3
(or formatted however you like). No changes to Lua, you get exactly what
you want. Sure, if you "import" a library like "math" you'll get:
local math = require "math"
local abs = math.abs
local acos = math.acos
local asin = math.asin
local atan = math.atan
local atan2 = math.atan2
local ceil = math.ceil
local cos = math.cos
local cosh = math.cosh
local deg = math.deg
local exp = math.exp
local floor = math.floor
local fmod = math.fmod
local frexp = math.frexp
local huge = math.huge
local ldexp = math.ldexp
local log = math.log
local log10 = math.log10
local max = math.max
local min = math.min
local modf = math.modf
local pi = math.pi
local pow = math.pow
local rad = math.rad
local random = math.random
local randomseed = math.randomseed
local sin = math.sin
local sinh = math.sinh
local sqrt = math.sqrt
local tan = math.tan
local tanh = math.tanh
but I see this as A Good Thing(TM)---you document exactly what you are
using and it's obvious to anyone using Lua what you are doing.
-spc
- References:
- Re: mathlib, Ralph Hempel
- Re: mathlib, Roberto Ierusalimschy
- Re: mathlib, Dirk Laurie
- Re: mathlib, Roberto Ierusalimschy
- Re: mathlib, Coroutines
- Re: mathlib, Luiz Henrique de Figueiredo
- Re: mathlib, Roberto Ierusalimschy
- Re: mathlib, Christopher Berardi
- Re: mathlib, steve donovan
- Re: mathlib, Christopher Berardi