|
|
Examples of recursion: string-merge |
The function string-merge zips two lists of strings to a single string. The lists are not necessarily of equal lengths |
| The recursive function string-merge. Notice that this function is a general recursive function.
The recursive call, emphasized above, is not in a tail position, because of the embedding in string-append. |
This is a typical task in a web program, where a list of elements needs to be aggregated for HTML presentation purposes.
Notice the merging of a list of n elements with a list of length n-1. The function make-list is another LAML function;
(make-list n el) makes a list of n occurrences of el. |