Tridiagonal Lists in Scheme (define (tridiagonal n)
   (build-list n 
               (lambda (x)
                 (build-list n 
                           (lambda (x)
                             (cond
                               [(= x n) 2]
                               [(or (= x (- n 1))
                                    (= x (+ n 1))) 1]
                               [else 0]))))))


The above is my attempt at making a tridiagonal patterns of lists.
Restrictions:


Consumed integer n is greater than 2
At most 3 non-zero value occour in a list.


Examples:

(tridiagonal 3) =&gt; (list (list 2 1 0) (list 1 2 1) (list 0 1 2))
(tridiagonal 5) =&gt; (list (list 2 1 0 0 0) (list 1 2 1 0 0) (list 0 1 2 1 0) (list 0 0 1 2 1) (list 0 0 0 1 2))
Your code doesn't actually work, because your two lambdas both used x as the parameter name, and the inner one shadows the outer one. Here's a fixed version:

(define (tridiagonal n)
  (build-list n
              (lambda (x)
                (build-list n
                            (lambda (y)
                              (cond
                                [(= x y) 2]
                                [(or (= x (sub1 y))
                                     (= x (add1 y))) 1]
                                [else 0]))))))


This works, but in Racket, it's probably more idiomatic to use for/list for creating a list:

(define (tridiagonal n)
  (for/list ((i (in-range n)))
    (for/list ((j (in-range n)))
      (max 0 (- 2 (abs (- i j)))))))


As you can see, I've taken the liberty of simplifying your cond expression too, into a single (max 0 (- 2 (abs (- i j)))) expression.