30 lines
508 B
Scheme
30 lines
508 B
Scheme
;; Hello world as a variable
|
|
(define vhello "Hello world")
|
|
;; Hello World as a function
|
|
(define fhello (lambda ()
|
|
"hello world"))
|
|
|
|
;; hello with name
|
|
(define hello
|
|
(lambda (name)
|
|
(string-append "hello " name "!")))
|
|
|
|
;; sum of three numbers
|
|
(define sum3
|
|
(lambda (a b c)
|
|
(+ a b c)))
|
|
|
|
(define add1
|
|
(lambda (a)
|
|
(+ a 1)))
|
|
|
|
(define sub1
|
|
(lambda (b)
|
|
(- b 1)))
|
|
(display(string-append "sub1 to 2 is " (number->string(sub1 2)) "\n"))
|
|
|
|
|
|
;; display message on screen
|
|
(display "Hello World!")
|
|
|