jank development update - Lazy sequences!

submited by
Style Pass
2024-04-27 19:00:06

This quarter, I'm being funded by Clojurists Together to build out jank's lazy sequences, special loop* form, destructuring, and support for the for and doseq macros. Going into this quarter, I had only a rough idea of how Clojure's lazy sequences were implemented. Now, a month in, I'm ready to report some impressive progress!Lazy sequences

There are three primary types of lazy sequences in Clojure. I was planning on explaining all of this, but, even better, I can shine the spotlight on Bruno Bonacci's blog, since he's covered all three of them very clearly. In short, we have:Per-element lazy sequencesChunked lazy sequencesBuffered lazy sequences

This month, I have implemented per-element lazy sequences, along with partial support for chunked lazy sequences. Chunked lazy sequences will be finished next month. By implementing even per-element lazy sequences, so many new opportunities open up. I'll show what I mean by that later in this post, so don't go anywhere!Loop

Prior to this month, jank supported function-level recur. As part of this month's work, I also implemented loop* and its related recur. When we look at how Clojure JVM implements loop*, it has two different scenarios:Expression loopsStatement loops

Leave a Comment