Describing a Dragon Curve with Prolog

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 5

  • @maverickstclare3756
    @maverickstclare3756 3 роки тому +6

    I could watch these every day :)

  • @lacknerish
    @lacknerish 3 роки тому +6

    Yet another great video. Thanks.
    If you have time in the future it would be cool to learn how your presentation tool works. The graphics and stuff you do for way of illustration are really interesting, and you must have figured out some elegant ways to generate them given your skill set.. :)

  • @k9-guardian785
    @k9-guardian785 2 роки тому

    Apologies if this is a dumb question, but I was wondering if I should use DCGs solely for list appending. For example, instead of doing `append(As, Bs, Cs)`, you could say `phrase((As, Bs), Cs)`. I'm not sure whether I should use one or the other.

    • @ThePowerOfProlog
      @ThePowerOfProlog  2 роки тому

      I would phrase it like this: When append/3 occurs in a program, it is often a sign that it would benefit from using DCGs. A single use of append/3 in a program such as append(As, Bs, Cs) is equivalent to phrase((seq(As),seq(Bs)), Cs), and you can use one or the other. Note that I am using seq//1 to make it usable in many directions, also if As and Bs are variables. In that case, append(As, Bs, Cs) is shorter and that may make it preferable; however, a drawback of append/3 is definitely the imperative connotation ("append" is in imperative). If you know that As and Bs are lists, you can use phrase((As,Bs), Cs) as in your example, and I find that as least as readable as using append/3.

    • @k9-guardian785
      @k9-guardian785 2 роки тому

      @@ThePowerOfProlog I see. Thank you for the quick reply!