refactor: move argscheck et.al. into std.base module.

Unfortunately, debug.say is a very high level function that pulls
in a lot of other modules, modules that we'd like to be able to
add debug.argscheck to... since argscheck has almost no pre-
requisites, move it into the base module where it can then be
available everywhere else.
* lib/std/container.lua (prototype): Move from here...
* lib/std/base.lua (prototype): ...to here.
* lib/std/debug.lua (concat, argerror, argcheck, argscheck):
Move from here...
* lib/std/base.lua (concat, argerror, argcheck, argscheck): ...to
here.
Be sure to disable argument checking if _DEBUG or _DEBUG.argcheck
are false.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
refactor: don't pull in all of debug's dependencies for array.

* lib/std/array.lua, lib/std/base_array.lua: Import argcheck and
argscheck from std.base.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
base: use argscheck for api functions.

* specs/base_spec.yaml (deprecate), specs/list_spec.yaml (elems):
Specify bad argument behaviours.
* specs/table_spec.yaml (metamethod): Add missing specifications,
including bad argument behaviours.
* lib/std/base.lua (deprecate, elems, metamethod): Use argscheck
to implement specified behaviours.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
refactor: omit spurious parentheses around require result dereferences.

* lib/std/container.lua, lib/std/object.lua, lib/std/set.lua,
lib/std/string.lua, lib/std/tree.lua, specs/container_spec.yaml,
specs/list_spec.yaml, specs/object_spec.yaml,
specs/set_spec.yaml, specs/spec_helper.lua.in: Omit spurious
parentheses around require result dereferences.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
functional: use argscheck for api functions.

* specs/functional_spec.yaml (metamethod): Remove.  This method
has moved to std.table.
(bind, case, collect, compose, curry, eval, filter, fold, map)
(memoize): Specify behaviour with missing or wrong type
arguments.
* lib/std/functional.yaml (bind, case, collect, compose, curry)
(eval, filter, fold, map, memoize): Add argscheck calls to
validate arguments when _DEBUG or _DEBUG.argcheck are not false.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
functional: bind should not require respecifying fixed args.

* specs/functional_spec.yaml (bind): Move incumbent examples to
a new legacy example.  Rewrite original examples with new api.
Add specifications for behaviour when not all arguments are
given in the call to the bound function.
* lib/std/functional.lua (bind): Fill initial argument positions
from original bind arguments, and then propagate final call
arguments into non-fixed parameter positions.
* NEWS: Update.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
debug: argcheck can match functable with "function".

* specs/debug_spec.yaml (argcheck): Specify correct behaviour
when matching a functable against a "function" argument.
* lib/std/base.lua (argcheck): Allow functables when a "function"
type argument is required.
* lib/std/debug.lua (argcheck): Update LDocs.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
functional: complete specs and improve LDocs.

* lib/std/functional.lua (bind, case, curry, compose, eval)
(collect, map, filter, fold): Improve LDocs with usage examples,
and cross-references.
* specs/functional_spec.yaml (collect, compose, curry, eval)
(filter, fold, id, map, memoize): Add missing specifications.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
refactor: merge std.base_array into std.array.

Instead of a one-way degrading from alien.buffer managed elements
to table managed elements with a sub-type, combine both sets of
optimised methods and metamethods back into a single `std.array`
container, which decides with each clone operation how to manage
elements of the named type.
* specs/array_spec.yaml: Specify behaviours for Array object that
dispatches module function calls at runtime, and assigns
optimized methods and metamethods on cloned objects according to
element type.
* lib/std/base_array.lua (pop, push, realloc, set, shift, unshift)
(__index, __newindex, __len, __tostring): Move from here...
* lib/std/array.lua (core_functions.pop, core_functions.push)
(core_functions.realloc, core_functions.set, core_functions.shift)
(core_functions.unshift, core_metatable.__index)
(core_metatable.__newindex, core_metatable.__len)
(core_metatable.__tostring: ...to here.
(pop, push, realloc, set, shift, unshift, __index, __newindex):
Move from here...
(alien_functions.pop, alien_functions.push, alien_functions.set)
(alien_functions.realloc, alien_functions,shift)
(alien_functions.unshift, alien_metatable.__index)
(alien_metatable.__newindex): ...to here.
(core_metatable.__call): Clone a new Array object, setting the
method and metatables with functions optimised for alien.buffer
or Lua table based element management according to availability of
alien, and element type name.
(dispatch): New runtime virtual table dispatch function.
(Array): Dispatch module functions at runtime based on element
type.
* lib/std/base_array.lua: Remove.
* local.mk (dist_luastd_DATA): Remove lib/std/base_array.lua.
* specs/base_array_spec.yaml: Remove.
* specs/specs.mk (specl_SPECS): Remove specs/base_array_spec.yaml.
* NEWS: Update.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>