Skip to content

Releases: Technologicat/unpythonic

Version 0.13.0

25 Feb 10:45
Compare
Choose a tag to compare

"I'll evaluate this later" edition:

New:

  • lazify macro: call-by-need for Python (a.k.a. lazy functions, like in Haskell)
  • frozendict: an immutable dictionary
  • mogrify: in-place map for mutable containers
  • timer: a context manager for performance testing
  • s: create lazy mathematical sequences. For example, s(1, ...), s(1, 2, ...), s(1, 2, 4, ...) and s(1, 2, ...)**2 are now valid Python. Regular function, no macros.
  • m: endow any iterable with infix math support. (But be aware that after that, applying an operation meant for general iterables drops the math support; to restore it, m(result) again.)
  • The unpythonic.llist module now provides JackOfAllTradesIterator that understands both trees and linked lists (with some compromises).
  • nb macro: a silly ultralight math notebook.

Breaking changes:

  • dyn: the asdict and items methods now return a live view.
  • The mutable single-item container Box and its data attribute value have been renamed to box and x, respectively.
  • namedlambda macro: Env-assignments are now processed lexically, just like regular assignments. Added support for let-bindings.
  • curry macro: The special mode for uninspectables is now enabled lexically within the with curry block. Also, manual uses of the curry decorator (on both def and lambda) are now detected, and in such cases the macro now skips adding the curry decorator.

Non-breaking improvements:

  • namelambda now supports renaming any function object, and also multiple times.
  • The single-item special binding syntax is now supported also by the bindings block of the dlet, dletseq, dletrec, blet, bletseq and bletrec macros.

Version 0.12.0

09 Jan 14:40
Compare
Choose a tag to compare

"Metamagical engineering" edition:

What does "metamagical" mean? To me, it means "going one level beyond magic". There is an ambiguity here: on the one hand, the word might mean "ultramagical" - magic of a higher order - yet on the other hand, the magical thing about magic is that what lies behind it is always nonmagical. That's metamagic for you!
--Douglas R. Hofstadter, On Self-Referential Sentences (essay, 1981)

New:

  • Alternative, haskelly let syntax let[((x, 2), (y, 3)) in x + y] and let[x + y, where((x, 2), (y, 3))]
    • Supported by all let forms: let, letseq, letrec, let_syntax, abbrev
  • When making just one binding, can now omit outer parentheses in let: let(x, 1)[...], let[(x, 1) in ...], let[..., where(x, 1)]
  • unpythonic.misc.Box: the classic rackety single-item mutable container
  • Many small improvements to documentation

Breaking changes:

  • New, perhaps more natural call_cc[] syntax for continuations, replaces earlier with bind[...]
    • Conditional continuation capture with call_cc[f() if p else None]
    • cc parameter now added implicitly, no need to declare explicitly unless actually needed (reduces visual noise in client code)
  • Local variables in a do are now declared using macro-expr syntax local[x << 42], looks more macropythonic
  • Silly (lambda) suffix removed from names of named lambdas (to detect them in client code, it's enough that isinstance(f, types.LambdaType))

Version 0.11.1

22 Nov 15:02
Compare
Choose a tag to compare

"Cleaning up, vol. 2" edition:

Enhancements:

  • Create a proper decorator registry for the syntax machinery.
    • Can now register priorities for custom decorators to tell the syntax system about their correct ordering (for sort_lambda_decorators, suggest_decorator_index).
    • Register priorities for (some of) unpythonic's own decorators using this new system, replacing the old hardcoded decorator registry.
    • Now lives in unpythonic.regutil; used only by the syntax subsystem, but doesn't require MacroPy just to start up.
  • Try to determine correct insertion index for trampolined and curry decorators in macros that insert them to decorator_list of FunctionDef nodes (using any already applied known decorators as placement hints, like a programmer would).
  • namedlambda: recognize also decorated lambdas, and calls to curry where the last argument is a lambda (useful for looped_over et al.).

Breaking change:

  • Remove the special jump target SELF.
    • Was always a hack; no longer needed now that v0.11.0 introduced the general solution: the withself function that allows a lambda to refer to itself anywhere, not just in a jump.
    • Now the whole thing is easier to explain, so likely a better idea (ZoP §17, 18).

Version 0.11.0

15 Nov 12:22
Compare
Choose a tag to compare

"Spring cleaning in winter" edition:

New:

  • Add @callwith: freeze arguments, choose function later
  • Add withself: allow a lambda to refer to itself
  • Add let_syntax: splice code at macro expansion time
  • Add quicklambda: block macro to combo our blocks with MacroPy's quick_lambda
  • Add debug option to MacroPy bootstrapper

Enhancements:

  • prefix macro now works together with let and do

Bugfixes:

  • detect TCO'd lambdas correctly (no longer confused by intervening FunctionDef nodes with TCO decorators)
  • scoping: detect also names bound by For, Import, Try, With

Breaking changes:

  • Rename dynscope --> dynassign; technically dynamic assignment, not scoping
  • Rename localdef --> local; shorter, more descriptive
  • scanr now returns results in the order computed (CAUTION: different from Haskell)
  • simple_let, simple_letseq --> let, letseq in unpythonic.syntax.simplelet
  • cons now prints pythonically by default, to allow eval; use .lispyrepr() to get the old output
  • Remove separate dynvar curry_toplevel_passthrough; expose curry_context instead

Other:

  • Reorganize source tree, tests now live inside the project
  • Pythonize runtests, no more bash script
  • Add countlines Python script to estimate project size

Version 0.10.4

29 Oct 10:02
Compare
Choose a tag to compare

"573 combo!" edition*:

  • new: macro wrappers for the let decorators
  • fix: trampolined() should go on the outside even if the client code manually uses curry()
  • enh: improve tco, fploop combo
  • enh: improve lexical scoping support

Version 0.10.3

25 Oct 11:30
Compare
Choose a tag to compare

"Small fixes" edition:

  • enh: curry macro now curries also definitions (def, lambda), not only calls
  • fix: spurious recomputation bug in do[]
  • update and fix READMEs and docstrings

Version 0.10.2

24 Oct 09:01
Compare
Choose a tag to compare

"Just a few more things" edition:

Bugfixes:

  • Arities:
    • Compute arities of methods correctly
    • Workaround for some builtins being uninspectable or reporting incorrect arities
  • Macros:
    • An implicit curry(f) should call f also if no args
    • Fix missing optional_vars in manually created withitem nodes

Version 0.10.1

23 Oct 19:40
Compare
Choose a tag to compare

"Just one more thing" edition:

  • continuations: create continuation using same node type (FunctionDef or AsyncFunctionDef) as its parent function
  • autoreturn: fix semantics of try block
  • fix docstring of tco

Version 0.10.0

23 Oct 12:49
Compare
Choose a tag to compare

"0.10.0 is more than 0.9.∞" edition:

  • Add more macros, notably continuations, tco, autoreturn
  • Polish macros, especially their interaction
  • Remove old exception-based TCO, rename fasttco to tco

Version 0.9.2

09 Oct 11:04
Compare
Choose a tag to compare

"Through the looking glass" edition:

  • new multilambda block macro: supercharge regular Python lambdas, contained lexically inside the block, with support for multiple expressions and local variables. Use brackets to denote a multi-expression body.
  • new fup macro providing more natural syntax for functional updates; allows using slice syntax.
  • upgrade: the let macros can now optionally have a multi-expression body. To enable, wrap the body in an extra set of brackets.
  • remove the 0.9.0 multilambda λ; brittle and was missing features.

The macros implement the multi-expression bodies by inserting a do; this introduces an internal-definition context for local variables. See its documentation in the macro_extras README for usage.

The macro_extras README now includes a table of contents for easy browsability.