Closed Technologicat closed 4 years ago
0.14.1 9 June 2019 - Retrofuturistic edition:
Language version:
New:
Popper
, a pop-while iterator.window
, a length-n sliding window iterator for general iterables.autoref[]
can now be nested.dbg[]
now supports also an expression variant, customizable by lexically assigning dbgprint_expr
. See the README on macros for details.Bugfixes:
mogrify
is now part of the public API, as it should have been all along.mg
function in the README.Non-breaking changes:
namelambda
for Python 3.8.dbg[]
is now listed as a convenience feature in the README.0.14.0 18 March 2019 - "Dotting the t's and crossing the i's" edition:
Bugfixes:
setup.py
: macros are not zip safe, because ZipImporter
fails to return source code for the module and MacroPy needs that.do[]
macro; ExpandedDoView
should now work correctlylazify
macrodict_items
handling in mogrify
(fixes the use of the curry
macro with code using frozendict
)New:
roview
: a read-only view into a sequence. Behaves mostly the same as view
, but has no __setitem__
or reverse
.mg
: a decorator to mathify a gfunc, so that it will m()
the generator instances it makes.do[]
macro now supports delete[name]
to delete a local variable previously created in the same do-expression using local[name << value]
.envify
block macro, to make formal parameters live in an unpythonic env
.autoref
block macro, to implicitly reference attributes of an object (for reading only).Breaking changes:
macropy3
bootstrapper now takes the -m
option; macropy3 -m somemod
, like python3 -m somemod
. The alternative is to specify a filename positionally; macropy3 somescript.py
, like python3 somescript.py
. In either case, the bootstrapper will import the module in a special mode that pretends its __name__ == '__main__'
, to allow using the pythonic conditional main idiom also in macro-enabled code.view
now checks that the input is not read-only (roview
, or a Sequence
that is not also a MutableSequence
) before allowing creation of the writable view.env
now checks finalization status also when deleting attrs (a finalized env
cannot add or delete bindings)Non-breaking improvements:
env
now provides also the collections.abc.MutableMapping
API.tco
macro now skips nested continuations
blocks (to allow Lispython in Pydialect to support continuations
).setup.py
now installs the macropy3
bootstrapper.0.13.1 1 March 2019 - "Maybe a slice?" edition
New:
view
: writable, sliceable view into a sequence. Use like view(lst)[::2]
. Can be nested (i.e. sliced again). Any access (read or write) goes through to the original underlying sequence. Can assign a scalar to a slice à la NumPy. Stores slices, not indices; works also if the length of the underlying sequence suddenly changes.islice
: slice syntax support for itertools.islice
, use like islice(myiterable)[100:10:2]
or islice(myiterable)[42]
. (It's essentially a curried function, where the second step uses the subscript syntax instead of the function call syntax.)prod
: like sum
, but computes the product. A missing battery.iindex
: like list.index
, but for iterables. A missing battery. (Makes sense mostly for memoized input.)inn(x, iterable)
: contains-check (x in iterable
) for monotonic infinite iterables, with automatic termination.getattrrec
, setattrrec
(recursive): access underlying data in an onion of wrappers.primes
and fibonacci
generators, mainly intended for testing and usage examples.SequenceView
and MutableSequenceView
abstract base classes; view
is a MutableSequenceView
.Breaking changes:
fup[]
utility macro to functionally update a sequence is gone and has been replaced by the fup
utility function, with slightly changed syntax to accommodate. New syntax is like fup(lst)[3:17:2] << values
. (This is a two-step curry utilizing the subscript and lshift operators.)ShadowedSequence
, and hence also fupdate
, now raise the semantically more appropriate IndexError
(instead of the previous ValueError
) if the replacement sequence is too short.namelambda
now returns a modified copy; the original function object is no longer mutated.Non-breaking improvements:
ShadowedSequence
now supports slicing (read-only), equality comparison, str
and repr
. Out-of-range access to a single item emits a meaningful error, like in list
.env
and dyn
now provide the collections.abc.Mapping
API.cons
and friends: BinaryTreeIterator
and JackOfAllTradesIterator
now support arbitarily deep cons structures.0.13.0 25 February 2019 - "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 dictionarymogrify
: in-place map
for mutable containerstimer
: a context manager for performance testings
: 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.)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.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.dlet
, dletseq
, dletrec
, blet
, bletseq
and bletrec
macros.0.12.0 9 January 2019 - "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:
let
syntax let[((x, 2), (y, 3)) in x + y]
and let[x + y, where((x, 2), (y, 3))]
let
forms: let
, letseq
, letrec
, let_syntax
, abbrev
let
: let(x, 1)[...]
, let[(x, 1) in ...]
, let[..., where(x, 1)]
unpythonic.misc.Box
: the classic rackety single-item mutable containerBreaking changes:
call_cc[]
syntax for continuations, replaces earlier with bind[...]
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)do
are now declared using macro-expr syntax local[x << 42]
, looks more macropythonic (lambda)
suffix removed from names of named lambdas (to detect them in client code, it's enough that isinstance(f, types.LambdaType)
)0.11.1 22 November 2018 - "Cleaning up, vol. 2" edition:
Enhancements:
sort_lambda_decorators
, suggest_decorator_index
).unpythonic.regutil
; used only by the syntax subsystem, but doesn't require MacroPy just to start up.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:
SELF
.
withself
function that allows a lambda to refer to itself anywhere, not just in a jump
.0.11.0 15 November 2018 - "Spring cleaning in winter" edition:
New:
Enhancements:
Bugfixes:
Breaking changes:
Other:
0.10.4 29 October 2018 - "573 combo!" edition*:
0.10.3 25 October 2018 - "Small fixes" edition:
curry
macro now curries also definitions (def
, lambda
), not only callsdo[]
0.10.2 24 October 2018 - "Just a few more things" edition:
Bugfixes:
curry(f)
should call f
also if no args optional_vars
in manually created withitem
nodes0.10.1 23 October 2018 - "Just one more thing" edition:
continuations
: create continuation using same node type (FunctionDef
or AsyncFunctionDef
) as its parent functionautoreturn
: fix semantics of try block0.10.0 23 October 2018 - "0.10.0 is more than 0.9.∞" edition:
continuations
, tco
, autoreturn
fasttco
to tco
0.9.2 9 October 2018 - "Through the looking glass" edition:
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.fup
macro providing more natural syntax for functional updates; allows using slice syntax.let
macros can now optionally have a multi-expression body. To enable, wrap the body in an extra set of brackets.λ
; 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.
0.9.0 5 October 2018 - "Super Syntactic Fortress MACROS" edition:
unpythonic.syntax
, adding syntactic macros for constructs where this improves usability. See macro_extras
for documentation.
curry
(automatic currying for Python) and cond
(multi-branch conditional expression, usable in a lambda), and macro variants of the let
constructs (no boilerplate).from unpythonic.syntax import macros, ...
.let
/letrec
.unpythonic.fun.apply
.0.8.8 25 September 2018 - "More spicy" edition:
Changes:
curry
: by default, TypeError
if args remaining when exiting top-level curry context
curry_toplevel_passthrough
to switch the error offrotate
now conceptually shifts the arg slots, not the values; this variant seems easier to reason about.curry
, compose
, pipe
New:
make_dynvar
, to set a default value for a dynamic variable. Eliminates the need for if 'x' in dyn
checks.with curry
block. (Make your Python look somewhat like Haskell.)Bugfixes/optimizations:
nth
: fix off-by-one bugdyn
: skip pushing/popping a scope if no bindings given0.8.7 24 September 2018 - "More iterable" edition:
Changes:
scanr
now syncs the left ends of multiple inputs, as it should.ShadowedSequence.__init__
rscanl
, rfoldl
, the new names of sync right ends of multiple inputs, then map/zip from the right, are rmap
, rzip
.llist
, lreverse
are now more ducky/pythonic.New:
rscanl
, rscanl1
, rfoldl
, rreducel
: reverse each input, then left-scan/left-fold. This approach syncs the right ends if multiple inputs.mapr
, zipr
(map-then-reverse): sync left ends of multiple inputs, then map/zip from the right.rev
: try reversed(...)
, if TypeError
then reversed(tuple(...))
butlast
, butlastn
, partition
0.8.6 20 September 2018 - "Adding in the missing parts" edition:
New features:
unfold
, unfold1
: generate a sequence corecursivelyimemoize
, fimemoize
)Enhancements:
call
now accepts also args (see docstring)Bugfixes:
0.8.5 19 September 2018 - "Liberté, égalité, fraternité" edition:
gtrampolined
: TCO (tail chaining) for generatorsgmemoize
: memoization for generatorsdyn
to parity with env
0.8.4 18 September 2018 - "Hunt for the missing operators" edition:
map_longest
, mapr_longest
, zipr_longest
unpack
is now curry-friendlyTechnical enhancements:
unpythonic.it
to use itertools
where possible0.8.3 18 September 2018 - "I have always wanted to code in Listhonkell" edition:
scanl
, scanr
: lazy partial fold (a.k.a. accumulate) that returns a generator yielding intermediate results.
scanl1
, scanr1
variants with one input sequence and optional init.iterate
: return an infinite generator yielding x
, f(x)
, f(f(x))
, ...
iterate1
) and n-in-n-out (iterate
) variants are provided. The n-in-n-out variant unpacks each result to the argument list of the next call.For usage examples see test()
in it.py.
0.8.2 17 September 2018
New features:
c
)Enhancements:
reversed
(by internally building a reversed copy)llist
just extracts the internal reversed copy when the input is reversed(some_ll)
curry
compose
variants.
1
for one-arg variants, or c
for the new currying variants.i
suffix for iterable input always goes last.0.8.1 14 September 2018
New feature:
forall
; see unpythonic.amb
moduleEnhancements:
unpythonic.llist
no longer depends on unpythonic.tco
0.8.0 12 September 2018
Features:
unpythonic.it
: batteries for itertools (new)unpythonic.fun
: batteries for functools (significant changes)unpythonic.fup
: functionally update sequences and mappings (new)unpythonic.llist
by default (easier, no special cases for the user)Bugfix:
curry
with passthrough: use up all kwargs at the first step which got too many positional arguments (since no simple reasonable way to decide to which later application they would belong)0.7.0 4 September 2018
unpythonic.fun
cons
and friends: unpythonic.llist
(not loaded by default; depends on unpythonic.tco
)rc.py
was missing from the distribution, breaking TCO0.6.1 29 August 2018 (hotfix for 0.6.0)
Bugfix:
UnknownArity
in all modules that use unpythonic.arity.arity_includes()
.0.6.0 29 August 2018
New and improved sequencing constructs.
do
--> pipe
piped
, lazy_piped
for shell-like pipe syntaxdo
: an improved begin
that can name intermediate results0.5.1 13 August 2018
letrec
(both versions)let
constructsenv
, require name to be an identifier even when subscriptingenable_fasttco()
to be able to switch it back off (during the same run of the Python interpreter)env
0.5.0 10 August 2018
enable_fasttco()
.0.4.3 9 August 2018
0.4.2 6 August 2018 (hotfix for 0.4.1)
0.4.1 6 August 2018 (hotfix for 0.4.0)
unpythonic.misc.pack
0.4.0 6 August 2018
@breakably_looped
, @breakably_looped_over
@immediate
to @call
; maybe the most descriptive short name given call/ec
and similar.0.3.0 6 August 2018
unpythonic.fploop
raisef
escape
to perform the raise
(simplifies trampoline, improves feature orthogonality)0.2.0 3 August 2018
@call/ec
arity
utilities@loop
-> @looped
; now loop
is the magic first positional parameter for the loop body@looped_over
let
behavior between the two implementations@trampolined
preserve docstrings@setescape
: parameter should be named tags
since it accepts a tuple0.1.0 30 July 2018
Initial release.
Currently changelogs live only on the GitHub releases page.
To keep the history together with the code, it would probably be better to adopt a development process where changelogs are kept in a CHANGELOG.md in the repo.
When a new version is about to be released, that's where to describe the changes (by adding a new section at the top); when the actual release is made, then the relevant section just needs to be copy'n'pasted to the release page.