Below is a simple program developed in the Scheme programming language to illustrate how functional languages operate. This particular program will perform the “vector product” or “cross product” of any two lists which atoms represent the vector’s numbers.
(define vectorproduct
(lambda (v1 v2)
(cond
((null? v1) 0)
((null? v2) 0)
(else
(+ (* (car v1) (car v2)) (vectorproduct (cdr v1) (cdr v2)) )
)
)
)
)
(vectorproduct '(2 3 4) '(5 6 7))
When run, the output is:
56 >


