top | item 18120435

TicTacToe in SQL (Postgres)

109 points| emrk | 7 years ago |bitbucket.org

16 comments

order

truth_seeker|7 years ago

Yep. Recursive CTE are most bad ass feature of SQL which makes it do stuff that LISP and Haskell does but more declaratively

garyclarke27|7 years ago

Cool, I’m curious, does anyone know - which langauge would use fewest number of characters, to create TicTacToe?

arghwhat|7 years ago

The special purpose language, TicTacToe-inator, where an input of zero length compiles to TicTacToe.

qubax|7 years ago

The "higher" the language and more declarative. "Higher" because all the lower level work of data structures/etc are taken care of or even embedded into the language itself. "Declarative" because in declarative languages you just express what you want, not how to get it ( which imperative languages have to do ).

Compare "SELECT * FROM TBL1" with what you would need to do in an imperative language.

You would have to open data connection, set up data structures and have to specify step by step what you want. Even if you had libraries doing most of the work, you would still need to specify step by step what you want to be done. Whereas with SQL, you specify what you want and let the language/interpreter/optimizer/engine figure out the rest.

That's only considering "number of characters". Now if you measured "executable size" or memory size or any other impact, it might be different.