Skip to content

Instantly share code, notes, and snippets.

@b4284
Created November 22, 2015 17:14
Show Gist options
  • Select an option

  • Save b4284/a4ea57d0897e4b45f632 to your computer and use it in GitHub Desktop.

Select an option

Save b4284/a4ea57d0897e4b45f632 to your computer and use it in GitHub Desktop.
;; guile -e adele-cd adele.scm <NUM>
(define (q4 n d)
(if (zero? d)
'(())
(let A ((res '()) (i d))
(if (zero? i)
res
(A (append res
(map (lambda (x) (cons i x))
(q4 (- n i) (min (- n i) i))))
(1- i))))))
(define (adele-cd args)
(let ((n (string->number (cadr args))))
(for-each (lambda (x) (display x) (newline)) (q4 n n))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment