Simple Examples

Simple Examples

Robbert Haarman

2010-12-11


Introduction

These simple examples should provide you with a basic feeling of what Scheme looks and feels like.

xyzzy

This program is about as simple as it gets. It shows what a basic program looks like, and can be used to test the compiler or interpreter.

name

This program asks for the user's name, and then greets the user. It demonstrates the use of read-line to read input, and introduces variables.

fahrenheit

This program converts a given temperature from degrees Fahrenheit to Celcius and the other way around. It introduces numbers, arithmetic, concatenation of strings, and conversion from numbers to strings.

fac

This program defines a function to compute factorials, and uses it to compute the factorial of a number supplied by the user. In addition to defining functions, it demonstrates the use of if.

Valid XHTML 1.1! Valid CSS! Viewable with Any Browser