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?
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?
1 Answer
Reset to default 2No, 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.
cons: A x B -> A x B
. Haskell cons is slightly stricter, but also insightful:cons : a -> [a] -> [a]
. – Justin Meiners Commented Feb 1 at 5:34(+ 1 1)
, you get2
, which looks like a swan. Coincidence?) – molbdnilo Commented Feb 1 at 9:22