Skip to content

Instantly share code, notes, and snippets.

@thomascothran
Created May 2, 2017 22:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thomascothran/87acef6b6345b290efb7b1766de50c64 to your computer and use it in GitHub Desktop.
Pascal's Triangle Solution in Scheme Lisp
; Numering rows and indices starting at 1
(define (cell-value row index)
(if (or (= row 1)
(= index 1)
(= index row))
1
(+ (cell-value (- row 1) (- index 1))
(cell-value (- row 1) index))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment