Theme-D-Golf

Examples

Here is "Hello World" using Theme-D-Golf:
            (define-proper-program (g-golf-examples hello2 main)

              (import (standard-library core)
                      (g-golf-examples hello2 _golf-imports))

              (define-simple-proc main (() <none> nonpure)
                (gtk-init 0 #f)
                (let ((window (cast <gtk-window> (gtk-window-new 'toplevel)))
                      (button (cast <gtk-button>
                        (gtk-button-new-with-label "Hello, World!"))))
                  (gtk-widget-set-width-request window 400)
                  (gtk-widget-set-height-request window 300)
                  (set-border-width window 10)
                  (add window button)
                  (gtype-instance-signal-connect
                    button 'clicked
                    (lambda (((args (rest <object>))) <object> nonpure)
                      (gtk-main-quit)
                      null))
                  (show-all window)
                  (gtk-main))))
          
The example programs can also be found in the Theme-D-Golf source package in subdirectory g-golf-examples.

Back to the main page

Last updated: May 17, 2020

Copyright (C) 2020 Tommi Höynälänmaa

tommi.hoynalanmaa@REMOVETHISiki.fi