Settings

Theme

TicTacToe in SQL (Postgres)

bitbucket.org

109 points by emrk 7 years ago · 19 comments

Reader

teej 7 years ago

Taking it to the next level -

Injecting a Chess Engine into Amazon Redshift

http://www.michaelburge.us/2017/09/10/injecting-shellcode-to...

netcraft 7 years ago

Here is a version you can play with online: https://dbfiddle.uk/?rdbms=postgres_11&fiddle=71940aadda50f5...

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

akerro 7 years ago

This Single SQL Query Solved My Sudoku In Seconds

http://oraclemine.com/sql-query-solved-sudoku-seconds/

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.

    • hnarn 7 years ago

      I love how cynical this comment is. You're absolutely right though, every language solves a specific problem, so it's kind of arbitrary what language does something in the shortest amount of letters.

      • wild_preference 7 years ago

        Well, this is trivia about our craft that we enjoy talking about and comparing. Consider that nobody is impressed by the TicTacToe DSL if it appeared among C, JS, and other languages we use. Not very cynical. It’d be a “heh” and move on.

        If you want to be critical, it’s the stupid statements and interpretations people make from the comparisons. Like the Perl guy coming out of the woodwork to point out how we’re a bunch of idiots for not seeing the beauty of the Perl oneliner. Or how it demostates that Go doesn’t need generics and how JS web coders aren’t real developers.

  • 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.

  • darekkay 7 years ago
  • jedimastert 7 years ago

    You could probably add an extension to HQ9+[0] that'll get the job done pretty quick

    [0]: https://esolangs.org/wiki/HQ9%2B

  • segmondy 7 years ago

    APL/J

  • anonu 7 years ago

    k

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection