[b]every time i run the following code :[/b] [italic] :- use_module(contestlib, [writeN/2]). cross(N) :- hor_line(N), N1 is N - 1, B1 is N1 // 2, Middle is N1 + B1, down(N,
Yes
The above is the opening text when executing my LPA Win-Prolog application.
Hello.
I first sent this email to LPA Prolog, but have not received any response.
I have been working for over 25 years with LPA Prolog – I have worked with their MacProlog versions as well as several Win-Prolog versions. I have worked mostly closely with Nicky Johns and some with Brian Steel.
I have been moderately to severely ill in the last 15 years. However I am back on a Ph.D. track and I desire to use Prolog as the scripting and programming language in my ultimate doctoral dissertation.
I have a very simple question. I am sure that I have done this Prolog programming before, but at the moment – I have just become overly frustrated by my inability to solve it.
I will check this forum daily. But if it does not go against Forum Rules (and I cannot imagine why it would. . .). Please also forward your reply posting as an email to my two email addresses as well.
And also reply back to both of my email addresses as it is very easy for me to miss an important email and to get lost and therefore never be seen due to SPAM. My two best email addresses are:
Stephen.Kirk@waldenu.edu
AND
kirk_kids3@cox.net
Please send a copy of your reply email to both of my e-addresses as SPAM causes me to miss a great amount of emails.
I would like simply to create a Prolog program, which will read from a text file, each character by character.
That is it. I feel that I should know this, as I know that I have done this before. But I have some sort of mental block disabling me as to remembering how exactly to do it.
I am using LPA WIN-PROLOG 4.600. In the below example, I do have the text file:
“C:\dell\temp.txt”.
My current Prolog script is as follows.
a:-
open('C:\dell\temp.txt', read, In),
getchar(In, Byte),
process_stream(Char1, In),
close(In).
When I execute the script. The output looks like:
| ?- a.
! ----------------------------------------
! Error 22 : Instantiation Error
! Goal : open('C:\dell\temp.txt',read,_51760)
Aborted
It has been a few years, since I have devoted myself to programming in Prolog. But I have done this type of programming before and I cannot comprehend, why I cannot remember how to do it. . . Help, please?
After a reply posting, please also send your feedback to both of my email address.
Thank you!
Take Care and God Bless!
Stephen Kirk.
Stephen.Kirk@waldenu.edu
kirk_kids3@cox.net
Comments
Please note this is a completely separate question about Prolog programming as I can not figure how to simply start a new post.
Subject of Post:Help with reading text files using Prolog
LPA WIN-PROLOG 4.600 - S/N 0014307049 - 05 Sep 2005
Copyright (c) 2005 Logic Programming Associates Ltd
Licensed To: Stephen Earl Kirk
B=64 L=64 R=64 H=256 T=2048 P=8192 S=64 I=256 O=256
Yes
The above is the opening text when executing my LPA Win-Prolog application.
Hello.
I first sent this email to LPA Prolog, but have not received any response.
I have been working for over 25 years with LPA Prolog – I have worked with their MacProlog versions as well as several Win-Prolog versions. I have worked mostly closely with Nicky Johns and some with Brian Steel.
I have been moderately to severely ill in the last 15 years. However I am back on a Ph.D. track and I desire to use Prolog as the scripting and programming language in my ultimate doctoral dissertation.
I have a very simple question. I am sure that I have done this Prolog programming before, but at the moment – I have just become overly frustrated by my inability to solve it.
I will check this forum daily. But if it does not go against Forum Rules (and I cannot imagine why it would. . .). Please also forward your reply posting as an email to my two email addresses as well.
And also reply back to both of my email addresses as it is very easy for me to miss an important email and to get lost and therefore never be seen due to SPAM. My two best email addresses are:
Stephen.Kirk@waldenu.edu
AND
kirk_kids3@cox.net
Please send a copy of your reply email to both of my e-addresses as SPAM causes me to miss a great amount of emails.
I would like simply to create a Prolog program, which will read from a text file, each character by character.
That is it. I feel that I should know this, as I know that I have done this before. But I have some sort of mental block disabling me as to remembering how exactly to do it.
I am using LPA WIN-PROLOG 4.600. In the below example, I do have the text file:
“C:\dell\temp.txt”.
My current Prolog script is as follows.
a:-
open('C:\dell\temp.txt', read, In),
getchar(In, Byte),
process_stream(Char1, In),
close(In).
process_stream(end_of_file, _) :-
-1.
process_stream(Char, In) :-
print(Char),
getchar(In, Char2),
process_stream(Char2, In).
When I execute the script. The output looks like:
| ?- a.
! ----------------------------------------
! Error 22 : Instantiation Error
! Goal : open('C:\dell\temp.txt',read,_51760)
Aborted
It has been a few years, since I have devoted myself to programming in Prolog. But I have done this type of programming before and I cannot comprehend, why I cannot remember how to do it. . . Help, please?
After a reply posting, please also send your feedback to both of my email address.
Thank you!
Take Care and God Bless!
Stephen Kirk.
Stephen.Kirk@waldenu.edu
kirk_kids3@cox.net