2

I'm trying to get into HiLog and am stuck from the very beginning. Even when boiled down to the most textbook example :

:- hilog sum.
sum(X,Y,Z):-Z is X + Y.

:- import bagReduce/4 from aggregs.

f(_):- bagReduce([1,2],Res,sum,0).

the compiler barfs :

[Existence (No procedure usermod : apply / 2 exists)]

Surely something very basic is missing ( Does apply really have to be imported? If so - from where? )

SysDragon
  • 9,692
  • 15
  • 60
  • 89
tcmon
  • 351
  • 2
  • 6
  • 1
    It is not the compiler but the runtime system that produces this error. BTW, higher order programming is equally possible using this ISO built-in `call/N`. – false Jun 11 '12 at 09:35
  • 1
    Thank you. I figured it out. Firstly, the the Bag in bagReduce(Bag,Res,BinOp,I) must be a predicate. The error message comes from the library trying to call '[1,2]'. Secondly, due to the way the XSB module system works, both the Bag and the BinaryOp must be declared hilog, else the aggregs module can't see them ( it relies on them beeing rewritten as apply( which lands in the global 'usermod' ). cheers – tcmon Jun 11 '12 at 11:56

0 Answers0