Glen Whitney a2fd057831
fix(simplify): Array and object simplification (#2382)
* fix(simplify): Allow simplify to work in arrays, objects, and indexing

  Mostly ArrayNode, ObjectNode, AccessorNode, and IndexNode nodes are
  simply transparent to simplification -- they simply allow it to occur
  within subexpressions. Then main exception is that if an array or object
  is indexed by a constant, the expression can be replaced by the
  corresponding subitem, e.g. `[3,4,5][2]` simplifies to `4`.

  This at least partially resolves #1913 (see my latest comment there).

* fix(simplify): Resolve operations on constant arrays

  This involves allowing ArrayNodes containing only constant entries
  to temporarily convert to Matrix type inside of simplifyConstant, so that
  function and operator calls can occur on them.
  I also had to add a special case for the function `size` because
  it can be computed even on symbolic arrays, since the result depends
  only on the shape, not the entries.

  Deals with additional cases of #1913; unclear if there are remaining
  aspects of that issue on which further work is desirable.

* chore: fix alphabetization of dependencies

  And restores inadvertent deletion of a blank line.

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2022-01-15 19:43:04 +01:00
..