(use iup srfi-1) (import iup-plot) (define (display-error message) (show (message-dialog value: message) modal?: #t) 'default) (define (add-plot! self) (condition-case (let* ((value (attribute input 'value)) (proc (eval (with-input-from-string value read))) (values (map (lambda (n) (cons n (proc n))) (iota 101)))) (call-with-plot plot (lambda (p) (for-each (lambda (datum) (let ((x (car datum)) (y (cdr datum))) (plot-add! p x y))) values) (refresh plot)))) (exn (exn) (let ((message ((condition-property-accessor 'exn 'message) exn))) (display-error (format "Error: ~A" message))))) 'default) (define plot (plot)) (define plot-button (button "Plot" action: add-plot!)) (define input (textbox "" expand: 'horizontal)) (define form (dialog defaultenter: plot-button startfocus: input (vbox plot (hbox input plot-button)))) (show form) (main-loop)