#lang racket/base ;; Racket's `read`, behind the typed import in sexp.rhm. Not for direct use. (require racket/port) (provide read_str read_stdin sexp_is_symbol sexp_is_number sexp_is_string sexp_is_list sexp_to_symbol sexp_to_number sexp_to_string sexp_length sexp_ref sexp_to_text) (define (read_str str) (with-input-from-string str read)) (define (read_stdin) (read)) (define (sexp_is_symbol x) (symbol? x)) (define (sexp_is_number x) (exact-integer? x)) (define (sexp_is_string x) (string? x)) (define (sexp_is_list x) (list? x)) (define (sexp_to_symbol x) x) (define (sexp_to_number x) x) (define (sexp_to_string x) (string->immutable-string x)) ;; Shplait lists are not Racket lists, so lists cross by length and index. (define (sexp_length x) (length x)) (define (sexp_ref x i) (list-ref x i)) (define (sexp_to_text x) (string->immutable-string (format "~s" x)))