Search code examples
schemelispdot-productcons

Cons and dot product related?


Does a Lisp or Scheme cons bear any similarities or theoretical kinship to a dot product? In the Lisp family (cons 1 2) produces (1 . 2) which looks a lot like a dot product. Just coincidence?


Solution

  • No, there's no relationship. Dot product is an operation that combines two matrixes. cons creates a container object that holds references to the two argument objects.

    The fact that they both use . in their notation is purely coincidence.