;; predicates.lq (define (string? x) (equal? (type x) 'string)) (define (pair? x) (equal? (type x) 'pair)) (define (empty? x) (equal? (type x) 'empty-list)) (define empty-list? empty?) (define (integer? x) (equal? (type x) 'integer)) (define (float? x) (equal? (type x) 'float)) (define (number? x) (or (integer? x) (float? x))) (define (list? x) (or (pair? x) (empty-list? x))) (define (keyword? x) (equal? (type x) 'keyword)) (define (dict? x) (equal? (type x) 'dict)) (define (boolean? x) (equal? (type x) 'boolean)) ;; basically, an atom is anything that is non-compound (define (atom? x) (not (or (list? x) (dict? x) (environment? x)))) (define (unspecified? x) (equal? (type x) 'unspecified)) (define (environment? x) (equal? (type x) 'environment)) (define (userdef-function? x) (equal? (type x) 'userdef-function)) (define (builtin-function? x) (equal? (type x) 'builtin-function)) (define (function? x) (or (userdef-function? x) (builtin-function? x))) (define (file? x) (equal? (type x) 'file))