#lang racket ; CSE 3302 Lab 2 Spring 2013 - just the simple version of generating assignments (only true lists) (define (first x) (car x)) (define (second x) (car (cdr x))) ; Tests for a name, rather than a list or boolean operator (define (name? x) (and (not (pair? x)) (not (null? x)) (not (number? x)) (not (eq? x 'N)) (not (eq? x 'A)) (not (eq? x 'O)) (char? x))) ; Tests for legal simple expression (define (exp? x) (cond ((name? x) #t) ((not (pair? x)) #f) ((eq? (first x) 'N) (and (exp? (second x)) (null? (cdr (cdr x))))) ((eq? (first x) 'O) (expList? (cdr x))) ((eq? (first x) 'A) (expList? (cdr x))) (else #f))) ; Tests arguments to boolean operators O and A ; Should not be called from top level (define (expList? x) (cond ((not (pair? x)) #f) ((exp? (car x)) (or (null? (cdr x)) (expList? (cdr x)))) (else #f))) ; tests membership in ordered list of chars (define (member? x l) (cond ((null? l) #f) ((char=? x (car l)) #t) ((char