(define for->named_let (lambda (exp) (cons (quote let) (cons (quote loop) (cons (getStartValue exp) (cons (cons (quote if) (makeIfStatement exp)) '())))))) (define getStartValue (lambda (exp) (car (car (cdr exp))))) (define getEndOperation (lambda (exp) (cons (car (cdr (cdr exp))) '()))) (define getLoop (lambda (exp) (cons (quote loop) (car (cdr (cdr (car (cdr exp)))))))) (define makeIfStatement (lambda (exp) (if (null? exp) '() (cons (getCheck exp) (cons (getLoop exp) (getEndOperation exp)))))) (define getCheck (lambda (exp) (car (Cdr (car (cdr exp)))))) (define pascal-triangle (lambda (X) (if (< x 0) '() (if (= x 0) '((1)) (cons (cons 1 (pascalHelper '() (car (pascal-triangle (- x 1))))) (pascal-triangle (- x 1))))))) ;;Always to be called with ls1 equal to '(). (define pascalHelper (lambda (ls1 ls2) (if (null? (cdr ls2)) '(1) (cons (+ (car ls2) (car (cdr ls2))) (pascalHelper ls1 (cdr ls2))))))