## 3.1 Format of Scripts

In Oz, a script takes the form of a procedure

> `proc {Script Root}
> %% declare variables
> in
> %% post constraints
> %% specify distribution strategy
> end`

The procedure declares the variables needed, posts the constraints modeling the problem, and specifies the distribution strategy.

The argument `Root` stands for the solutions of the problem to be solved. If the solutions of a problem are given by more than one variable, say `X`, `Y`, and `Z`, we may simply combine these variables into one record by posting a constraint like

> `Root = solution(x:X y:Y z:Z)`

The procedure

> `{SearchAll Script ?Solutions}`

will run the script `Script` until the entire search tree is explored and return the list of the solutions found.

The procedure

> `{SearchOne Script ?Solutions}`

will run the script `Script` until the first solution is found. If a solution is found, it is returned as the single element of a list; otherwise, the empty list is returned.