0

The following code works in swi-prolog:

:- asserta(user:file_search_path(money, '/media/D/db')).
dataFile(F) :-
absolute_file_name(money('test.dat'), F, []).

It seems there is no module in gprolog. How can i make it work under gprolog ?

Sincerely!

1 Answers1

0

You do not give enough details but I deduce the problem is the operator ':-' Try with 'initialization/1'

$ cat > file.pl

initialization(asserta(user:file_search_path(money, '/media/D/db'))).
dataFile(F) :- absolute_file_name(money('test.dat'), F, []).
^d

$ gprolog --init-goal "['file.pl']"
compiling /Users/user/file.pl for byte code...
/Users/user/file.pl compiled, 2 lines read - 763 bytes written, 8 ms
GNU Prolog 1.4.1
By Daniel Diaz
Copyright (C) 1999-2012 Daniel Diaz
| ?- 

Hope this work…

Manolo
  • 1,500
  • 1
  • 11
  • 15
  • consult is OK but file_search_path(money,X). uncaught exception: error(existence_error(procedure,file_search_path/2),top_level/0) | ?- dataFile(X). uncaught exception: error(existence_error(procedure,absolute_file_name/3),dataFile/1) – user2098292 Mar 05 '13 at 02:22
  • file_search_path is not an ISO directive and it is not implemented by [gnuprolog](http://www.gprolog.org/manual/gprolog.pdf). You have to look for an alternative or implement your own directive (check the file processing and operating system interface) – Manolo Mar 06 '13 at 21:46