最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

scheme - Cons and dot product related? - Stack Overflow

programmeradmin0浏览0评论

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?

Share Improve this question asked Feb 1 at 5:17 147pm147pm 2,23321 silver badges37 bronze badges 2
  • 1 Dot product has a generalization as an inner product - which is a set of axioms for a binary function on a vector space. I don't see similarity. It's a coincidence. Cons simply maps two lisp values to a pair of those value 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 It is a convention for printing. The pair doesn't actually look like anything at all. (If you evaluate (+ 1 1), you get 2, which looks like a swan. Coincidence?) – molbdnilo Commented Feb 1 at 9:22
Add a comment  | 

1 Answer 1

Reset to default 2

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.

发布评论

评论列表(0)

  1. 暂无评论