Currently loop/recur is limited to 'single-layered' loops: loop forms can occur inside other loop forms, but there is no facility for 'recurring to an outer loop'. This is fine in a lot of everyday high-level code, but can be problematic in implementations of algorithms structured as nested loops that may need to be terminated early, particularly if performance is a significant concern.
In this talk I will discuss my proposal (Clojure ticket CLJ-2235) to extend the loop/recur facility to nested loops in a way that preserves the key semantic properties of regular loop/recur (recur only possible in tail position w.r.t. the target loop, arguments to recur must match loop locals introduced in the corresponding loop form etc.) and arguably feels like a natural extension of loop/recur, both syntactically and semantically. I will also briefly discuss the details of my patches to the Clojure and ClojureScript compilers which implement the above.
In this talk I will discuss my proposal (Clojure ticket CLJ-2235) to extend the loop/recur facility to nested loops in a way that preserves the key semantic properties of regular loop/recur (recur only possible in tail position w.r.t. the target loop, arguments to recur must match loop locals introduced in the corresponding loop form etc.) and arguably feels like a natural extension of loop/recur, both syntactically and semantically. I will also briefly discuss the details of my patches to the Clojure and ClojureScript compilers which implement the above.
Named loop + recur-to: extending the loop + recur-to paradigm to nested loops – Michał Marczyk | |
8 Likes | 8 Dislikes |
258 views views | 1,162 followers |
Science & Technology | Upload TimePublished on 17 Sep 2018 |
Không có nhận xét nào:
Đăng nhận xét