Skip to content

Coconut v2.2.0

Compare
Choose a tag to compare
@evhub evhub released this 30 Dec 20:32
· 617 commits to master since this release

See Coconut's documentation for more information on all of the features listed below.

Major changes:

  • #694: New multiset built-in based on collections.Counter, including new multiset literal syntax (m{1, 1, 2, 3, 3, 4}).
  • #691: New Expected built-in based on Haskell's Either, plus new safe_call built-in that calls a function while collecting any errors into an Expected. Additionally, the of built-in has been renamed to call (of is still available as a deprecated alias when compiled without --strict).
  • #701: New windowsof built-in for iterating over sliding windows of the given iterable.
  • #688: New cartesian_product built-in as an enhanced version of itertools.product including numpy support.
  • #690: New cycle built-in as an enhanced version of itertools.cycle.
  • #704, #703, #702, #693, #692: Lots of improvements to existing built-ins:
    • map now supports a strict=True keyword-only argument that works as in zip.
    • flatten now supports a levels argument for how many levels to flatten.
    • groupsof now supports a fillvalue argument to pad the last group.
    • addpattern now accepts any number of pattern-matching functions.
    • memoize now accepts a function to memoize as the first argument.
  • #710: New None-aware function composition pipes (e.g. f ..?> g).

Minor changes:

  • #686: Type parameter bounds can (and should) now use <: syntax instead of : or <= (e.g. def f[T <: int[])(xs: T) -> T = ...).
  • #711: Backwards None-aware pipes now supported (e.g. <?|).
  • #708: Pattern-matching against data types with default arguments now allows those defaults to be elided in the match.
  • #697: :: now produces a reiterable object when called on reiterable objects.
  • #706: Multiple Coconut projects should now be able to seamlessly use each other's MatchErrors when compiled in --package mode.
  • #695: Set literal syntax now supports star unpacking.
  • #699: Support for __bool__ magic method fixed on Python 2.
  • #687: Jupyter kernel and other automatic compilations now uses --no-wrap.
  • #685, #684: Improved detection of code issues on and off --strict.
  • #700: Some confusing unicode alternatives were removed.
  • #698: Typing for fmap has been improved.
  • #689: Improved numpy support for some built-ins.
  • #705: Many Coconut built-ins have now been made weakrefable.