Skip to content

Instantly share code, notes, and snippets.

@shirok
Created April 24, 2017 13:56
Show Gist options
  • Select an option

  • Save shirok/d3da9e29b0a5cd847c9be61e87bf79cf to your computer and use it in GitHub Desktop.

Select an option

Save shirok/d3da9e29b0a5cd847c9be61e87bf79cf to your computer and use it in GitHub Desktop.
gosh> (define (foo ls)
(if (null? ls)
'(0)
(map + ls (append (foo (cdr ls)) '(0)))))
foo
gosh> (foo '(1 2 3))
(6 5 3)
;; 1 2 3
;; 2 3 0
;; + 3 0 0
;; ------
;; 6 5 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment