Guile

See parts IV and V of the Guile Reference Manual for additional Scheme functions and types defined within the Guile environment.

How to Write a Loop in Scheme

The most frequently asked question seems to be: how do I write a loop in Scheme? We give a few answers to that here, supposing that we want to vary a parameter x from a to b in steps of dx, and do something for each value of x.

libctl has a couple of built-in functions arith-sequence and interpolate (see the user reference) to construct lists of a regular sequence of values, which you can use in conjunction with map as above:

(map (lambda (x)...dostuffwithx...) (arith-sequence x-min dx num-x))

or

(map (lambda (x)...dostuffwithx...) (interpolate num-x (list a b)))

Finally, if you have an entire libctl input file myfile.ctl that you want to loop, varying over some parameter x, you can do so by writing a loop on the Unix command-line. Using the bash shell, you could do: