5 ms·
It's the unreasonable effectiveness of a language and an approach that has some real mathematical backing behind it (relational algebra). Lisps are unreasonabl
by nine_k 8y ago
It's the unreasonable effectiveness of a language and an approach that has some real mathematical backing behind it (relational algebra).
Lisps are unreasonably effective because they have lambda calculus behind them. The Hindley-Milner type system and linear types, both mathematically sound, are a large part of Rust's effectiveness and success, in my eyes.
I still would like that SQL read a bit more set-theoretic, if less English-like. It would make it less quirky and more composable.
- darksaints 8y ago> I still would like that SQL read a bit more set-theoretic, if less English-like. It would make it less quirky and more composable. I wish that it didn't introduce an incomprehensible ternary logic for null handling. SQL with algebraic data types would be amazing.
- nine_k 8y agoNulls are facts of life. I wonder how they could be succinctly represented in a query language. Something like the `?` operator in C# / Kotlin?
- andrewflnr 8y agoThat would be an improvement. I'd rather have proper algebraic sum types, though (Option or Optional in languages like Haskell, OCaml, et al). They're really useful for all kinds of stuff. Perfectly representing missing values is almost a fringe benefit.
- darksaints 8y agoNot only would algebraic sum types be awesome, but if user-defineable they could eliminate so much of the ambiguity in how nulls are practically used in SQL. People often say that null just means unknown but that is a bug-causing simplification. In reality, null could mean unknown, but it could also mean not yet known, uninitialized, missing, impossible, uncomputable, join conditions not met, or hundreds of other things. And sum types would be extremely useful even outside of null handling...there are thousands of reasons why more and more modern languages are designed with sum types. Not only would sum types be extremely helpful but it would also be awesome to have a standard for product types. As it stands, some implementations have them but they are clunky, and others you have to resort to just using multiple columns, which is pretty bad for composability, bug-ridden, and leads to behavior that is almost like Hungarian notation in order to maintain unique column naming. For example: create table foo( start zoneddatetime, end zoneddatetime ... ); versus create table foo( start_time timestamp, start_tz timezone, end_time timestamp, end_tz timezone ... ); (timestamptz is not an acceptable substitute...it doesn't store timezone)
- rosser 8y agoSQL's null really isn't incomprehensible. It just means "unknown". It's broadly like "undefined" in js.
- setr 8y ago3VL stuffed into a boolean logic system is what’s incomprehensible.
- crgwbr 8y agoI assume you mean how null has to be compared with the IS operator instead of equality? I’ve wondered the same thing, but would making Null==Null have some strange consequences for left join operations? You could pretty easily and unintentionally return the Cartesian product of the two tables. Requiring a different operator for comparing to bill prevents that.
- darksaints 8y agoHaving optional types (or algebraic sum types) would eliminate this as well has hundreds of other sources of bugs, and would eliminate the 3 valued logic that few users truly understand.
- darkpuma 8y ago> "Lisps are unreasonably effective because they have lambda calculus behind them." I don't really buy that. CL remains unreasonably effective even when used by somebody using it in an imperative manner. And I think the majority of CL code out there is truly multi-paradigm, not functional. I think most of the unreasonable effectiveness comes from the relationship between s-expressions and cons.
- nine_k 8y agoBeing imperative / functional is sort of orthogonal. The s-expressions that represent everything give you an immense power of composability, both in functions and in macros. You can define your own language in terms of Lisp in a way you can't in a Algol derivative. I suppose that s-expressions and the ways to transform them when they represent a function application (that is, basically always) critically depend on lambda calculus. I can be wrong, though.
- darkpuma 8y agoAs I understand it, lambda calculus is strictly functional. I also think the relationship between s-expressions and lambda calculus is tenuous at best. If anything, it's s-expressions and lambda calculus that are orthogonal. You could use s-expressions as your notation for lambda calculus, but you could just as well not.
- lisper 8y agoYou are correct. S-expressions are a serialization format for trees and lambda calculus is a computational formalism. There is no inherent connection between them. You can have either one without the other. However, the two together make a really magical combination because each one is a sort of local maximum in its respective design space.
- dreamcompiler 8y agoOf course. Haskell is even more faithful to lambda calculus than Lisp (because it has automatic currying and no side effects) but it doesn't use s-expressions at all.
- bryanrasmussen 8y agoSo they have inherited their unreasonable effectiveness from the unreasonable effectiveness of Mathematics? Sounds about right.