Prolog Lists

Поделиться
HTML-код
  • Опубликовано: 6 ноя 2024

Комментарии • 29

  • @VADroidTS555
    @VADroidTS555 4 года назад +6

    Thank you for these videos! You have a great presentation style.

    • @ThePowerOfProlog
      @ThePowerOfProlog  4 года назад +2

      Thank you for your kind words, it is really encouraging to hear this! Enjoy!

  • @sabbirneplumpstein334
    @sabbirneplumpstein334 4 месяца назад +1

    This was so helpful! Thanks

  • @PixelOutlaw
    @PixelOutlaw Год назад

    You can see parallels between Lisp's car and cdr. Interesting... I heard there was cross pollination between them.

  • @derekfrost8991
    @derekfrost8991 4 года назад +1

    I've been playing with prolog lists using peano axioms instead of numbers. So for example calculating 0, succ(0), succ(succ(0)) etc. It works much better in prolog than hacky arithmetic. Inc(N, succ(N)) can be used in both directions.. :)

    • @ThePowerOfProlog
      @ThePowerOfProlog  4 года назад +2

      Nice! Then here is a challenge: Implement nat_nat_sum/3, relating two natural numbers in this representation to their sum, in such a way that the predicate terminates for as many modes as possible. For instance, can you implement a version that terminates if at least two of the arguments are ground? How about only one of the arguments?

    • @derekfrost8991
      @derekfrost8991 4 года назад

      @@ThePowerOfProlog I know how to do add/3. I don't understand what the difference is.. :)

    • @derekfrost8991
      @derekfrost8991 4 года назад

      @@ThePowerOfProlog add(0,_,0). add(s(n),m,p) :- add(n,m,p). I think.. :)

    • @ThePowerOfProlog
      @ThePowerOfProlog  4 года назад +1

      @@derekfrost8991 For example, with your current definition, does the following query terminate?
      ?- nat_nat_sum(s(s(0)), Y, Z), false.
      If so, that's one example where the predicate terminates universally, which is nice. What about the following query, where the first argument is not known, but the second argument is known:
      ?- nat_nat_sum(X, s(s(0)), Z), false.
      Does it terminate? If not, is there a way to change the definition so that this query terminates too?

    • @derekfrost8991
      @derekfrost8991 4 года назад

      @@ThePowerOfProlog I know it terminates with 2 args in any direction, but with only one it seems impossible.. :)

  • @sidatiyoussouf5084
    @sidatiyoussouf5084 4 года назад

    Thank for these vidios , do you know algorithms Eval / Apply ?

  • @peterkosmas9518
    @peterkosmas9518 3 года назад

    hello , are you using any kind of program that represents the list on the right that i see?

    • @ThePowerOfProlog
      @ThePowerOfProlog  3 года назад +2

      Yes! I have made these definitions available in the Scryer Prolog repository, please have a look: github.com/mthom/scryer-prolog/tree/master/tools
      I hope they work for you, enjoy!

  • @mulyevishvesha1283
    @mulyevishvesha1283 4 года назад

    I want to ask you that can we use Prolog in any language.. it is possible??

  • @TheJanstyler
    @TheJanstyler Год назад

    God, I hate this. My Professor is incredibly bad at explaining this already (in my opinion) complicated topic (not lists but Prolog in general). And on top of all that, we can't even use RUclips to have proper explanations because he insists on his notation and his way of doing things in Prolog, and his ways seem vastly different than what I've seen in videos. Its so god damn frustrating. He is the main reason I have Prolog with a passion.