Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. xristiana

    permutation list

    Hello to everyone, I am studying from a prolog tutorial, but I have stuck in a programm, and can't figure it out at all. It's the perm predicate, I think it's in the prolog or sth, it's definition is this(with the definition of takeout too that it uses): takeout(X,[X|R],R)...
  2. xristiana

    need help pleaze

    Hey, write it in English to get answers.
  3. xristiana

    reverse_list

    Ok, thank you.:)
  4. xristiana

    reverse_list

    When I put trace, reverse_list([5]). ,it says undefined reverse_list/1, however there is a definition for reverse_list/2.
  5. xristiana

    reverse_list

    Thank you.
  6. xristiana

    reverse_list

    Hi, I don't understand how this programm works. reverse_list([], []). reverse_list([Head | Tail], ReversedList) :- reverse_list(Tail, ReversedTail), append(ReversedTail, [Head], ReversedList). It is assumed to reverse a list, but I don't know what calls does it make and with what order. Can...
  7. xristiana

    couples

    Ok, now I got it thanks. I didn't understand why B is [6,7], it's a little bit difficult, but now I get it. We use backtracking.
  8. xristiana

    couples

    In the 2 elements list, B was []. Now, in the 4 elements list, B is [[6,7]] from the clause you made that I didn't understand. I also don't understand this: "B is the result of couples([6, 7], B)." I'm quite confused. :S
  9. xristiana

    couples

    No, I understand this equivalence, what I don't understand is this: "We know that couples([6, 7], B) computes B = [[6, 7]] because [6, 7] is a 2-element list.
  10. xristiana

    couples

    Ok, I understand with two elements. The problem is with four elements, but you don't have to explain it if you don't want to.
  11. xristiana

    couples

    Sorry, I am not English and I can't explain it further. I' m talking about the meaning here and in the meaning we use firstly the if clause. That's what I 'm saying. In the Swi- prolog, it is obvious that it happens secondly, not firstly I was wrong. I didn't understand how B is [[6,7]].
  12. xristiana

    couples

    Yes, but again you explained me about what Swi-prolog does, I am talking about the meaning here. How can we say if for sth, if it happens first in the Swi-prolog and the meaning? That's what I'm saying. And also, I would like you to tell me if you can, what is saved in the B list when we insert...
  13. xristiana

    couples

    Thank you, but I asked the opposite. What's the translation, the meaning of the second rule if we use if. Since the meaning starts from the second clause with if, then how the first action (the separation of H and H1) happens first. Now you got it?
  14. xristiana

    couples

    But I have a general question, which for example in this programm, is that since we separate the H and H1 in the head of the rule, how can the body be the first action? Do you get what I mean? That we say first the body, but the first action is on the head of the rule. I don't understand how...
  15. xristiana

    couples

    Oh sorry I had forgotten the first rule....
  16. xristiana

    couples

    But when I insert couples([4,5,6,7,8,9],S). it says false. :S
  17. xristiana

    couples

    I didn't understand what I had done wrong, but I understood the explanation of the correct programm. :) About the first rule, I translated that when we finish rule 2, what shall we have for rule 1? So, my translation was wrong if you get it. Thank you so much for everything! Be well!
  18. xristiana

    couples

    Sorry, pair_list is another name for couples.. So, my programm is that: couples([], _). couples([H, H1|A], B) :- append([H], [H1], L), couples(A, [L|B]). Sorry, I don't understand your explanation, what I thought my programm does is: First, seperates H and H1 from the body. It uses append to...
  19. xristiana

    couples

    Hi, I want to apologize to all and especially Mr. Kahleen for my continuous asking for help, but I have boggled. Here's what I have to do next, I have a list A and a list B with the couples of the elements of list A, for example: list A=[4,5,6,7,8,9] and list B=[[4,5],[6,7],[8,9]]. I have made a...
  20. xristiana

    list with mutual elements

    Oh, ok:) Thanks :) And I was trying to figure out! Thank you very much, I have another one programm and this is the end for now. :)

Part and Inventory Search

Back
Top