0

I am getting an error when adding elements to a heap in prolog. When I add a priority, key pair to the heap it adds it as t(Priority,Key,[]) which causes my program to crash further down the line.

Here's the code in question:

astar(Start,Seed,Target,Found) :-
    empty_heap(Heap),
    h(Start,Priority,Target),
    add_to_heap(Heap,Priority,Start,Newheap),
    search(Newheap,Seed,Target).

Note: I am using gtrace, and the returned values from empty_heap and h are bother correct (heap(nil,0) and 1).

All help appreciated!

false
  • 10,264
  • 13
  • 101
  • 209
lumpofiron
  • 154
  • 1
  • 8

0 Answers0