Created
March 12, 2019 18:32
-
-
Save bakpakin/c0295eb52ec1bcca1e3b353d154ed23b to your computer and use it in GitHub Desktop.
Indented Fennel example by fennel.vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn line-iter [packets] | |
(var buf "") | |
(fn recur [] | |
(local (residual rest) (: buf :match "^(.*)\r\n(.*)$")) | |
(if residual | |
(do (set buf rest) residual) | |
(let [packet (packets)] | |
(when packet | |
(set buf (.. buf packet)) | |
(recur)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment