6 ms·
That's a useless distinction. Everything is an object in Python. Does that mean Python doesn't have values?
by in_the_sticks 10y ago
That's a useless distinction. Everything is an object in Python. Does that mean Python doesn't have values?
- catnaroek 10y agoIt has primitive values: (0) small enough numbers (1) True, False, None, etc. (2) object references But it doesn't have compound values. And the distinction isn't useless. Values have a richer equational theory than objects, enabling lots of automatic optimizations.
- qwertyuiop924 10y ago...And outside FP, nobody cares, or uses that definition of value. As noted in my above post.
- catnaroek 10y agoIt's useful when writing Prolog programs too.
- qwertyuiop924 10y agoLogic programming's actually pretty close to FP.
- catnaroek 10y agoNot really. Prolog is first-order. Functional languages, just like object-oriented ones, are higher-order.
- qwertyuiop924 10y ago"Close," not "is."
- catnaroek 10y agoThere's very little in common, beyond the notions of mathematical variable and value. Syntactically, a functional program is an expression, but a logic program is a proposition. Operationally, functional programs run already constructed proofs, but logic programs search for proofs. Pragmatically, transcribing a logic program into a functional language or vice versa is difficult without effectively writing an interpreter for an embedded DSL. Or maybe by “close”, you mean “both are about equally difficult to wrap my head around”?
- qwertyuiop924 10y agoDon't mock me. And yes, I did mean the notion of mathematical value and variable. That's one of the core tenets of both.
- catnaroek 10y ago> I did mean the notion of mathematical value and variable. That's one of the core tenets of both. Maybe from a big distance this is enough similarity to lump functional and logic programming together. But on closer inspection, functional and logic programs are still very different. > Don't mock me. I wasn't mocking you. You clearly must not understand functional and logic programming very well, if you think they are in some way “close”.
- qwertyuiop924 10y agoThey are somewhat close in paradigm: They both favor declarativism, and have mathematical values. Given, they're pretty far apart in paradigm, but those are some strong similarities.
- catnaroek 10y ago> declarativism I'm not familiar with that term. Could you give a rigorous definition? Anyway, after some googling, I found a very plausible definition that makes functional programming not a declarative paradigm: http://semantic-domain.blogspot.com/2013/07/what-declarative-languages-are.html http://semantic-domain.blogspot.com/2013/07/what-declarative...