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: *

  • Users: madarb
  • Order by date
  1. madarb

    How to write these predicates

    1. person(P):-man(P). person(P):-woman(P). 2.dont know how you use childTo.assuming child is first then parents.so: fatherTo(A,B):-childTo(B,A,_),man(A). fatherTo(A,B):-childTo(B,_,A),man(A). 3. father(A):-man(A),childTo(_,A,_). father(A):-man(A),childTo(_,_,A). and it goes...
  2. madarb

    Nested List Lengths

    completely theoretical: your list is like [A,B,C,...,X] where letters are inner lists. make a predicate that uses length(A,Length) where A is the list you are referring to and Length is a var that gives you its length. any help?
  3. madarb

    Help multiplying two lists

    sorry for that i meant to make that point to the one in the very end but it didnt work out well :D
  4. madarb

    Help multiplying two lists

    have you tried writing it this way? i know it doesnt answer your question but you need to put that "1" there to make it work. listprod(X, Y, Sum):- checkList(X, NewListX, Num1), checkList(Y, NewListY, Num2), Sum1 is Sum+(Num1*Num2), listprod(NewListX, NewListY, Sum1)...
  5. madarb

    need an assignment to study my final exam

    its not complicated at all. describe all your people as male(name) or female(name) and one basic relationship f.ex. father/mother. from there on create predicates such as a)parent(X,Y):-father(X,Y). parent(X,Y):-mother(X,Y). b)brother(X,Y):-parent(Z,X),parent(Z,Y),male(X). [Z is parent both...
  6. madarb

    Lists searching

    thanks a lot for the reply but i really dont understand what it is you're doing. could you explain what findall and listing does?
  7. madarb

    Prolog Help. Help would be greatly appreciated

    for 3a and 3c i do not understand the explanation you give. if you could specify it more maybe i could do something about it.
  8. madarb

    Prolog Help. Help would be greatly appreciated

    for 3b. display_items([]). display_items([H|T]):-put(H),display_items(T). though it produces the elements in the list,it leaves no spaces and also produces a "Yes" in the end. if it doesnt suit you, try to alter it yourself to meet with your needs.
  9. madarb

    Prolog Help. Help would be greatly appreciated

    for b. right([X],El):-El=X. right([_|T],El):-right(T,El).
  10. madarb

    Prolog Help. Help would be greatly appreciated

    for a. insert(Element,OldList,NewList):-NewList = [Element|OldList].
  11. madarb

    Please Help me with this Problem

    happy to help man ;) sorry for the mistakes as i said before its just what crossed my mind.
  12. madarb

    Please Help me with this Problem

    cartesian_product([H|T],B):- cartesian_product_1(H,B),cartesian_product(T,B). cartesian_product_1(H,[H1,T1]):- put(H),write( {*spaces*} ), put(H1),cartesian_product_1(H,T1). its just a thought.i dont know whether it works, i didnt run it.if i had this problem this is what id think first. if...
  13. madarb

    Lists searching

    i have the following problem: i have facts of flights using lists and im trying to find a way to search inside lists. here's how the facts are described: flight(london,milan, [[times(depart(8),arrive(11)),code(ba510),mo,tu,we,th,fr,sa,su]...

Part and Inventory Search

Back
Top