Skip to content

Instantly share code, notes, and snippets.

@llibra
Created March 14, 2012 14:34
Show Gist options
  • Save llibra/2036899 to your computer and use it in GitHub Desktop.
Save llibra/2036899 to your computer and use it in GitHub Desktop.
Series version foldl
(defun foldl (kons knil &rest series-inputs)
(apply #'series::basic-collect-fn (constantly knil) kons series-inputs))
(define-compiler-macro foldl (kons knil &rest series-inputs)
`(collect-fn t (constantly ,knil) ,kons ,@series-inputs))
(foldl #'- 0 (scan '(0 1 2 3 4)))
;=> -10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment