1.1.2 Scheme variables
Scheme variables can have any valid scheme value, including a Scheme
procedure.
Scheme variables are created with define
:
| guile> (define a 2)
guile>
|
Scheme variables can be evaluated at the guile prompt simply by
typing the variable name:
Scheme variables can be printed on the display by using the display function:
| guile> (display a)
2guile>
|
Note that both the value 2
and the guile prompt guile
showed up on the same line. This can be avoided by calling the
newline procedure or displaying a newline character.
| guile> (display a)(newline)
2
guile> (display a)(display "\n")
2
guile>
|
Once a variable has been created, its value can be changed with set!
:
| guile> (set! a 12345)
guile> a
12345
guile>
|