[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Re Atari BASIC versis Python versus Lua in 1982...
- From: Coda Highland <chighland@...>
- Date: Fri, 17 Mar 2017 21:31:37 -0700
On Sat, Mar 18, 2017 at 3:49 AM, Martin <firstname.lastname@example.org> wrote:
> On 03/17/2017 01:19 PM, Sean Conner wrote:
>>> Lua is missing simple but
>>> powerful string manipulation functions as the Basic has.
>> What? All I recall of BASIC string manipulations are LEFT$(), RIGHT$(),
>> MID$() and STRING$(), all of which can be replaced with string.sub() in Lua.
>> I recall those being pretty typical of the time.
> There are more.
> LEFT$/RIGHT$/MID$ - get part of string
> ~ string.sub
> MID$ - set part of string
> ~ string.gsub
> ~ string.len, # operator
> LTRIM$/RTRIM$ - trim spaces
> ~ string.gsub
> ~ string.(lower/upper)
> INSTR - find substring
> ~ string.find
> ~ tonumber/tostring
> ~ string.(char/byte)
> STRING$/SPACE$ - repeat one char <n> times,
> ~ string.rep
> MKI$/CVI/... - codecs to internal number formats (int, dbl, float, ...)
> ~ string.(pack/unpack)
> Generally I feel Lua functions more generic, more powerful and
> harder to master.
> Surely they are completely different languages. Lua is a more
> language itself, with central abstractions on tables, first-type
> functions and variable code. While QBASIC is a fixed interface to
> hardware that was available at that time. Lua is good for processing
> complex data structures while QBASIC is good for implementing UI.
> (BTW for Lua is a nice library Love2D which affords similar
> functionality as QBASIC - almost direct access to hardware without
> predefined UI elements.)
> (And I think that niche for data processing are still almost empty.
> Only regexps are there. (And probably map/reduce.))
> (Yes, we can do anything with C/Go/Pascal/Ada/.. but sometimes
> marginal simplicity and narrower application field are needed to
> implement complex things.)
> -- Martin
Most of those functions aren't present in traditional BASIC
implementations. The trim, case, find, and packing functions are
certainly not present.