Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.94 KB | None | 0 0
  1. (define eval-arith
  2.   '(let (member?
  3.          (lambda-rec (member-in-list? e list)
  4.                      (cond
  5.                        [(eq? list `()) false]
  6.                        [(eq? e (car list)) true]
  7.                        [true (member-in-list? e (cdr list))])))
  8.  
  9.      (let
  10.          (length
  11.           (lambda-rec (lenght list)
  12.                       (if (eq? list `())
  13.                           0
  14.                           (+ 1 (len (cdr list))))))
  15.        (let
  16.            (is-list?
  17.             (lambda-rec (is-list? list)
  18.                         (or (eq? list `())
  19.                             (and (pair? list)
  20.                                  (is-list? (cdr list))))))
  21.          
  22.          (let
  23.              (binop?
  24.               (lambda (e)
  25.                 (and (is-list? e)
  26.                      (and 😊 (length e) 3)
  27.                           (member? (car e) (cons-cons '+ (cons-cons '- (cons-cons '* (cons-cons '/ null)))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement