You can do it in xscm too!

"ccf::satchell"@hermes.dra.hmg.gb
Tue, 27 Jan 1998 18:57:41 GMT

Here is how to get results from guile in one text field from
expressions typed in another one, using xscm and the Mo(Less)tif
widget set.

The executable will surely have some other name on your system,
and if you have dynamic loading working, it might just be
/usr/local/bin/guile. Decent layout, fonts etc can be trivially
added, but would obscure the point. Enjoy!

#! /usr2/xscm-2.02b/xmscm -s
!#

(use-modules (ice-9 slib))

(require 'x11)
(require 'xt)
(require 'xm)
(require 'xmsubs) ;; need for make-captioned-text-widget

;; thunk takes one argument, a (string) port. Whatever is written to this
;; will be displayed on widget, assuming widget is some sort of text widget

(define call-with-output-widget (lambda (thunk widget)
(xt:set-values widget xm:n-value (call-with-output-string thunk))))

(let ((top-level (xt:app-initialize "text2" "Text2" )))
(xt:set-values top-level xm:n-allow-shell-resize #t
xm:n-height 200 xm:n-width 300 )
(let* ((main-window (xt:create-managed-widget "mw" xm:main-window top-level))
(textin (make-captioned-text-widget main-window "Input" 32))
(textout (make-captioned-text-widget main-window "Output" 32))
(hitit (lambda(w)
( call-with-output-widget
(lambda (s) (display (eval-string (xm:text-get-string w)) s))
textout ))))
(xt:add-callback textin xm:n-activate-callback hitit)
)
(xt:realize-widget top-level)
(xt:app-main-loop)
)