Sha256: 5c9b12d33b612bc179a8dc65c3cf7b3d2cb9efd1968f438dc72b5b480feb8815

Contents?: true

Size: 446 Bytes

Versions: 185

Compression:

Stored size: 446 Bytes

Contents

(defpackage #:pascal
  (:use #:common-lisp)
  (:export #:rows))

(in-package #:pascal)

(defun fact (n)
  (loop for i from 0 to n
        for fact = 1 then (* fact i)
        finally (return fact)))

(defun choose (n r)
  (/ (fact n)
     (* (fact r) (fact (- n r)))))

(defun rows (n)
  (if (> n 0)
      (loop for i from 0 to (1- n)
               collect (loop for j from 0 to i
                             collect (choose i j)))
      '()))

Version data entries

185 entries across 185 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.179 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.178 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.177 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.176 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.175 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.174 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.173 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.172 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.171 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.170 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.169 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.167 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.166 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.165 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.164 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.163 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.162 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.161 tracks/common-lisp/exercises/pascals-triangle/example.lisp
trackler-2.2.1.160 tracks/common-lisp/exercises/pascals-triangle/example.lisp