3 ms·
Side comment: Python doesn't have TCO, but Hy does have the loop/recur macros in its contrib library. They give you a version of tail recursion that looks a bit
by mumblemumble 6y ago
Side comment: Python doesn't have TCO, but Hy does have the loop/recur macros in its contrib library. They give you a version of tail recursion that looks a bit odd at first, but quite nice once you get used to it.
- gilch 6y agoHy's loop/recur had a serious bug last I checked: https://github.com/hylang/hy/issues/1465 https://github.com/hylang/hy/issues/1465 But see the @loop decorator from Drython for how to do this in Python: https://github.com/gilch/drython/blob/eb1773c14060e31e2544f5fb69dd31621d0bc291/drython/statement.py#L1003 https://github.com/gilch/drython/blob/eb1773c14060e31e2544f5...