Skip to content

Flatten nested Values with associative transformers

Choose a tag to compare

@FancyNeuron FancyNeuron released this 30 Jun 11:54
· 14 commits to main since this release
77976c4

New Features

  • Add many Value creation functions, like float_values.min_float, int_values.sum_ints and str_values.concatenate
  • Add StrValue.length -> IntValue
  • Allow caching of StrConstants with StrConstant.of("foo", cache=True)

Improvements

  • Adding, Multiplying, concatenating and many other associative operations on nested Values will now be flattened. This will reduce complexity of derived Value structures
  • Values derived entirely of constants or literals are now themselves constants. So IntConstant(3) + IntConstant(5) == IntConstant(8). This will reduce complexity of derived Value structures in some situations
  • Caching some constants, like ints in range [-100, 100], floats in range [-100.0, 100.0], bools {True, False} and some select single str chars
  • Other small performance improvements

Bug fixes

None

Breaking Changes

  • Removed many classes, like ClampFloatValue, which have been replaced more general classes, like ThreeFloatToFloatValue