#!/usr/bin/env gosh (define (main args) (let* ([A (read-num)] [op (read-op)] [B (read-num)]) (print ((if (equal? op #\+) - +) A B))) 0) (define (read-op) (read-char)) (define (read-num) (define (d? c) (memq c (string->list "0123456789"))) (let loop ([res '()]) (let1 c (peek-char) (cond [(and (pair? res) (not (d? c))) (string->number (apply string (reverse! res)))] [else (read-char) (loop (cons c res))]))))