Below is a more complex program developed in the Scheme programming language to illustrate how functional languages operate.
This particular program will take a list of atoms that are words. It will then locate the largest word among the list and output it as the result. It is performed by two functions that operate together, one that manipulates the list and one that compares the atoms.
(define bigword
(lambda (words)
(findbig (car words) (cdr words))
)
)
(define findbig
(lambda (biggest words)
(cond
((null? words) (display (symbol->string biggest)))
(else
(if (>= (string-length (symbol->string biggest)) (string-length (symbol->string (car words))))
(findbig biggest (cdr words))
)
(if (< (string-length (symbol->string biggest)) (string-length (symbol->string (car words))))
(findbig (car words) (cdr words))
)
)
)
)
)
(bigword '(Computer Science is a science of abstraction creating the right model for a problem and devising the appropriate mechanizable techniques to solve it))
When run, the output is:
mechanizable >
The general algorithm is as follows:
1. The sentence is a list with words as atoms
2. Going through the list check the first word’s length
3. Compare the next word length with the first’s
4. If first is larger, compare the third, fourth
5. If it is less, compare the second with third
6. Continue.


