Three Hello Worlds

The classic first program in any language is, of course the “Hello World” program. Here then, are three different version of “Hello World” written in PLT Scheme.

Console based (from Teach Yourself Scheme in Fixnum Days):

(begin
  (display "Hello, World!")
  (newline)

Web based (example program that comes with PLT Scheme servlet library):

(require (lib "unitsig.ss")
         (lib "servlet-sig.ss" "web-server"))

(unit/sig () (import servlet^)

  (define the-text "Hello, Web!")

  `(html (head (title ,the-text))
         (body ([bgcolor "white"])
               (p ,the-text))))

And finally, GUI Based (written by me):

(define greeting "Hello world!")
(define frame (instantiate frame% (greeting)))
(define msg (instantiate message% (greeting frame)))
(send frame show #t)

I still don’t know what the hell I’m doing, but it’s a start right?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s