-1

I'm new to prolog programing. I have gone through several sample answers, but couldn't find solution to my problem.

Here's my problem:

A list contains name and age [(ann,34),(john, 40), (dev,23)] , and I wanted to sort the list with increasing order of age, without using any predefined prolog functions. Is there a way I can do it?

Joel Fernandes
  • 4,776
  • 2
  • 26
  • 48
  • 1
    What have you done already? Are you struggling because of the sorting part or because of the pairs? Do you have an idea of the sorting algorithm you'd like to use? – m09 Mar 03 '14 at 06:47
  • 1
    See: http://stackoverflow.com/questions/8429479/sorting-a-list-in-prolog/8430692#8430692 – false Mar 03 '14 at 14:00

1 Answers1

1

(Not exactly an answer but yours is not a good question either)

Step 1: Decide what sorting algorithm you want to use. Keep in mind that some algorithms are better suited for Prolog than others (in general, an algorithm that would be appropriate for a linked list would be good for sorting a Prolog list).

Step 2: Try to translate the algorithm to Prolog. Test it on your own. If it doesn't work, update your question to contain your code, your input and output, your expected output, and point out the exact problem you are facing.