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 IamaSherpa 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. gomer555

    Rotate a list once to the right...

    Got it! Thanks a ton for the help joel, turned out to be a pretty easy solution after you figure it out, but isnt everything! rotate(List, R):- rotate(List, R1, H), R = [H|R1]. rotate([H], [], H). rotate([H|T], L, R) :- rotate(T, T1, R), L = [H|T1].
  2. gomer555

    Rotate a list once to the right...

    hmm, i tried to do what you've said but i havent been able to get what i want. Here is what i got so far, it will return the last element of the list, and also the list without the last element: rotate([H], [], H). rotate([H|T], [H|T1], R) :- rotate(T, T1, R). example query: rotate([1,2,3]...
  3. gomer555

    Rotate a list once to the right...

    Hello all. I am pretty new to prolog and understanding it so-so thus far. I have question, which seems simple, but i have not been able to come up with a solution. Its as follows: Given a list, rotate it to the right. An example query is rotate([1,2,3], R). => R=[3,1,2]; false. There is also...

Part and Inventory Search

Back
Top