New Mac user; can't read files

32 views
Skip to first unread message

Darrah Chavey

unread,
Sep 12, 2016, 4:39:15 PM9/12/16
to SWI-Prolog
Trying to use SWI-Prolog on a Mac. I installed the program, run it, and try to load the file "friends.pl" using the syntax from http://www.swi-prolog.org/FAQ/LoadProgram.html. I get the following:

1 ?- [friends].

ERROR: source_sink `friends' does not exist

2 ?- 


I placed a copy of "friends.pl" into every directory associated with the application, my User root directory, and my User desktop directory. Same result. The book "Seven Languages in Seven Weeks" says to put the filename in single quotes, ['friends'], so I do that; it fails. If I go to the Unix Terminal interface, I can manage to load the file by executing ./swipl -s friends.pl, but it seems like I should be able to do this via the Mac interface. Any suggestions?

Eyal Dechter

unread,
Sep 12, 2016, 4:42:19 PM9/12/16
to Darrah Chavey, SWI-Prolog
What directory are you in? Is the file in that directory? Open up swipl and type: 

?- pwd. 

and 

?- ls.

What does it say?  

Eyal

--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.

Darrah Chavey

unread,
Sep 12, 2016, 4:53:36 PM9/12/16
to SWI-Prolog, cha...@beloit.edu

That did it. It defaulted to the root directory, i.e. the directory above Applications and Users. Placing my input file there allowed it to be read. That’s not a good location for input files. How do I change the expected input directory? [/Users/chavey/friends]. fails.


On Monday, September 12, 2016 at 3:42:19 PM UTC-5, Eyal Dechter wrote:
What directory are you in? Is the file in that directory? Open up swipl and type: 

?- pwd. 

and 

?- ls.

What does it say?  

Eyal
On Mon, Sep 12, 2016 at 4:39 PM, Darrah Chavey <cha...@beloit.edu> wrote:
Trying to use SWI-Prolog on a Mac. I installed the program, run it, and try to load the file "friends.pl" using the syntax from http://www.swi-prolog.org/FAQ/LoadProgram.html. I get the following:

1 ?- [friends].

ERROR: source_sink `friends' does not exist

2 ?- 


I placed a copy of "friends.pl" into every directory associated with the application, my User root directory, and my User desktop directory. Same result. The book "Seven Languages in Seven Weeks" says to put the filename in single quotes, ['friends'], so I do that; it fails. If I go to the Unix Terminal interface, I can manage to load the file by executing ./swipl -s friends.pl, but it seems like I should be able to do this via the Mac interface. Any suggestions?

--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.

Torbjörn Lager

unread,
Sep 12, 2016, 5:49:41 PM9/12/16
to Darrah Chavey, SWI-Prolog
If all you need is a taste of Prolog (i.e. no serious project development), you may want to check out SWISH. See

  http://swish.swi-prolog.org/

Chances are that you'll be able to avoid installing anything at all, and do everything in "Seven Languages in Seven Weeks" using SWISH.

To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+unsubscribe@googlegroups.com.



--
Torbjörn Lager
Professor of General and Computational Linguistics
Department of Philosophy, Linguistics and Theory of Science
University of Gothenburg
Box 200, SE-405 30 Gothenburg, Sweden
Phone: +46317864962

Eyal Dechter

unread,
Sep 12, 2016, 8:38:38 PM9/12/16
to Darrah Chavey, SWI-Prolog
When loading a file you need to put single quotes around the path if it contains spaces, backslashes, or it starts with an uppercase letter (among other things; this will make sense when you learn about prolog syntax). You can change directories using predicate cd/1.

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages