Scheme Programming/Simple Expressions

From Wikibooks, open books for an open world
< Scheme Programming
Jump to: navigation, search

As we have already seen, Scheme expressions have the form:

(<Operation> <Operand 1> ... <Operand n>)

However, much simpler expressions are possible; all of the following are valid Scheme expressions and will be evaluated by the interpreter.

> 3
3
> #t
#t
> 6+1i
6.0+1.0i
> '(1 3 5)
(1 3 5)
> '(1 . ())
(1)
> #(1 3)
#(1 3)
> +
#<primitive-procedure +>

We have, in their respective order:

  • A number
  • A Boolean
  • A complex number (A number with and imaginary component)
  • A list
  • A pair
  • A vector
  • A primitive procedure (I.e. something that scm can use in order to evaluate data)