Prolog Coding Horror

(metalevel.at)

42 points | by RohanAdwankar 2 hours ago ago

11 comments

  • rtpg an hour ago

    There's something quite illuminating with this first "horror", where they basically say "it's OK to report wrong answers, because you can check the answers".

    I don't think I've ever felt like it's OK for my program to provide a list of answers where some are right and some are wrong, but reading this... and generally believing in P != NP.... maybe that's a decent way of looking at some stuff!

    • hedora 11 minutes ago

      The article server is offline, but I assume they found out that prolog rule evaluation depends on the order the rules are presented in the program.

      If so, the language they thought they were using (and that they should actually use) is datalog, not prolog.

      Datalog has declarative semantics: All facts that are derivable from the base database and the rules will be derived by the interpreter, and it will not add extra hallucinated facts. If that's not true, it's a bug in the runtime, not in the language.

    • DonHopkins 26 minutes ago

      Sometimes the Biorhythm program on my Apple ][ failed to produce correct answers. But it sure was great for impressing cool hippie chicks.

      https://www.youtube.com/watch?v=jYoY1cwAd90

  • appil an hour ago

    What do people use Prolog for in the real world? I learned about it on a university course and it seems so esoteric compared to other things on the course. Like something invented just for computer scientists to enjoy.

    • bmitch3020 5 minutes ago

      20+ years ago, it was the backend for the business rules engine that processed various logging and monitoring events. The concept was interesting, the performance was terrible, and businesses mostly didn't want to touch it. After I setup clients with a generic set of rules that worked on Prolog facts, most all of my clients were happy to limit their changes to only those fact files.

    • radomir_cernoch an hour ago

      Some applications were discussed in https://news.ycombinator.com/item?id=40994552

    • christophilus an hour ago

      Dunno about Prolog, but Datomic uses datalog for its query language, and it’s excellent. Datalog is a subset of Prolog.

      • ted_dunning 31 minutes ago

        Datalog may appear to be a subset, but it is quite distinct semantically.

      • raffael_de 30 minutes ago

        What is Datalog used for nowadays?

        • AlotOfReading a minute ago

          Other than databases, program analysis. The polonius borrow checker in rustc uses datalog internally.

  • crustycoder 2 hours ago

    Mostly overblown.