Skip to content

Instantly share code, notes, and snippets.

@bakpakin
Created March 12, 2019 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakpakin/c0295eb52ec1bcca1e3b353d154ed23b to your computer and use it in GitHub Desktop.
Save bakpakin/c0295eb52ec1bcca1e3b353d154ed23b to your computer and use it in GitHub Desktop.
Indented Fennel example by fennel.vim
(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