wip
This commit is contained in:
parent
fbdc710918
commit
7bbf3a5070
5 changed files with 57 additions and 1 deletions
10
pascal-line.rkt
Normal file
10
pascal-line.rkt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
;; The first three lines of this file were inserted by DrRacket. They record metadata
|
||||
;; about the language level of this file in a form that our tools can easily process.
|
||||
#reader(lib "htdp-advanced-reader.ss" "lang")((modname pascal-line) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #t #t none #f () #f)))
|
||||
(define (pascal-line n)
|
||||
(cond [(= n 0) (list 1)]
|
||||
[else (new-pascal-line (append (list 0) (pascal-line (- n 1)) (list 0)))]))
|
||||
|
||||
(define (new-pascal-line l)
|
||||
(cond [(< (length l) 2) empty]
|
||||
[else (cons (+ (first l) (second l)) (new-pascal-line (rest l)))]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue