You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/features.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ For many examples, see [the unit tests](unpythonic/tests/), the docstrings of th
81
81
82
82
*This document doubles as the API reference, but despite maintenance on a best-effort basis, may occasionally be out-of-date at places. In case of conflicts in documentation, believe the unit tests first; specifically the code, not necessarily the comments. Everything else (comments, docstrings and this guide) should agree with the unit tests. So if something fails to work as advertised, check what the tests say - and optionally file an issue on GitHub so that the documentation can be fixed.*
@@ -805,7 +805,9 @@ The ``with`` block adds a few elements, but if desired, it can be refactored int
805
805
806
806
To boldly go where Python without macros just won't. Changing the rules by code-walking and making significant rewrites.
807
807
808
-
### ``curry``: automatic currying for Python
808
+
### ``autocurry``: automatic currying for Python
809
+
810
+
**Changed in v0.15.0.***The macro is now named `autocurry`, to avoid shadowing the `curry` function.*
809
811
810
812
```python
811
813
from unpythonic.syntax import macros, autocurry
@@ -903,6 +905,8 @@ Inspired by Haskell, Racket's ``(delay)`` and ``(force)``, and [lazy/racket](htt
903
905
904
906
#### ``lazy[]`` and ``lazyrec[]`` macros
905
907
908
+
**Changed in v0.15.0.***Previously, the `lazy[]` macro was provided by MacroPy. Now that we use `mcpyrate`, which doesn't provide it, we provide it ourselves, in `unpythonic.syntax`. Note that a lazy value now no longer has a `__call__` operator; instead, it has a `force()` method. The utility `unpythonic.lazyutil.force` (available in the top-level namespace of `unpythonic`) abstracts away this detail.*
909
+
906
910
We provide the macros ``unpythonic.syntax.lazy``, which explicitly lazifies a single expression, and ``unpythonic.syntax.lazyrec``, which can be used to lazify expressions inside container literals, recursively.
907
911
908
912
Essentially, ``lazy[...]`` achieves the same result as ``memoize(lambda: ...)``, with the practical difference that a ``lazy[]`` promise ``p`` is evaluated by calling ``unpythonic.lazyutil.force(p)`` or ``p.force()``. In ``unpythonic``, the promise datatype (``unpythonic.lazyutil.Lazy``) does not have a ``__call__`` method, because the word ``force`` better conveys the intent.
@@ -919,6 +923,8 @@ The `unpythonic` containers **must be from-imported** for ``lazyrec[]`` to recog
919
923
920
924
#### Forcing promises manually
921
925
926
+
**Changed in v0.15.0.***The functions `force1` and `force` now live in the top-level namespace of `unpythonic`, no longer in `unpythonic.syntax`.*
927
+
922
928
This is mainly useful if you ``lazy[]`` or ``lazyrec[]`` something explicitly, and want to compute its value outside a ``with lazify`` block.
923
929
924
930
We provide the functions ``force1`` and ``force``. Using ``force1``, if ``x`` is a ``lazy[]`` promise, it will be forced, and the resulting value is returned. If ``x`` is not a promise, ``x`` itself is returned, à la Racket. The function ``force``, in addition, descends into containers (recursively). When an atom ``x`` (i.e. anything that is not a container) is encountered, it is processed using ``force1``.
0 commit comments