Search found 146 matches

by Peter Muraya
23 Sep 2015 17:37
Forum: Visual Prolog
Topic: Breakpoint properties and conditions
Replies: 9
Views: 5591

Thomas, The first attachment shows a point in the code where I want to break and observe certain variables under some condition. The problem is that very often I have to Debug Run very many times before I get to the condition of interest (and that is tiresome). I solve this by doing what is illustra...
by Peter Muraya
23 Sep 2015 16:40
Forum: Visual Prolog
Topic: Suggestion for isErroneous object predicate for interface array2M
Replies: 2
Views: 3778

Fine. I will follow the inheritance route.
by Peter Muraya
23 Sep 2015 7:06
Forum: Visual Prolog
Topic: Suggestion for isErroneous object predicate for interface array2M
Replies: 2
Views: 3778

Suggestion for isErroneous object predicate for interface array2M

Hi, I need to use a N by M matrix to manage a set of integers and have been thinking of objects created using the array2{integer}::newatomic constructor. To understand how this works I have done the following test, expecting to get a runtime error to the effect that position 0,0 is not set. Instead ...
by Peter Muraya
23 Sep 2015 5:48
Forum: Visual Prolog
Topic: Optional then in an if/then/else statement
Replies: 5
Views: 4406

Thank you Harrison for the link. VB has the notion of a multi-line syntax which Prolog does not (except for comments where % is for single line and /**/ is for mult-line) . So, the empty if statement can is coded in 2 different ways in VB:- ' Multiple-line syntax: If condition End If and ' Single-li...
by Peter Muraya
22 Sep 2015 17:14
Forum: Visual Prolog
Topic: Optional then in an if/then/else statement
Replies: 5
Views: 4406

... and if both then and else are omitted, then the compiler ignores the if/end if and executes the condition, so that:-

Code: Select all

... if condition() end if, ...
is equivalent to simply

Code: Select all

... condition(), ...
by Peter Muraya
22 Sep 2015 17:03
Forum: Visual Prolog
Topic: string::concat vs string::write
Replies: 5
Views: 5125

Thomas, Thanks. The message is that for intensive string work, of the following 5 string joining functions, the last one is better than all the others in terms of performance because it does not make and keep string copies. For less intensive work, the other alternatives may be much neater to use th...
by Peter Muraya
22 Sep 2015 9:08
Forum: Visual Prolog
Topic: Optional then in an if/then/else statement
Replies: 5
Views: 4406

Optional then in an if/then/else statement

Thomas,
I'm thinking about this code that does nothing on then:-

Code: Select all

if condition() then else do_something() end if
Suppose you do away with then, so that:-

Code: Select all

 if condition() else do_something() end if
is recognized as a valid statement. What are your thoughts on this?
by Peter Muraya
22 Sep 2015 8:41
Forum: Visual Prolog
Topic: string::concat vs string::write
Replies: 5
Views: 5125

Thank you Frank. You have added 2 other options that I also use occasionally. Is there any memory-use/execution-speed advantage of any one over the others? Or are all they based on a similar internal coding model?
by Peter Muraya
21 Sep 2015 8:35
Forum: Visual Prolog
Topic: string::concat vs string::write
Replies: 5
Views: 5125

string::concat vs string::write

Hi,
I often need to concatenate a number of strings, say, X,Y and Z. Which is the better practice than the other. And why?

Code: Select all

string::concat(X,Y,Z)
or

Code: Select all

string::write(X,Y,Z)  
by Peter Muraya
18 Sep 2015 7:51
Forum: Visual Prolog
Topic: Consult does not like class qualifiers. Does it?
Replies: 1
Views: 3766

Consult does not like class qualifiers. Does it?

Hi, I moved (by cut and pasting) the following facts from the code to an external file for consulting. There was a runtime problem that I traced to the data:: qualifier. Is that not legal? If not, what would be the reason? /* This database keeps track of fields from which a user can infer how data i...
by Peter Muraya
18 Sep 2015 6:31
Forum: Visual Prolog
Topic: Need window of backtrack points during debugging
Replies: 3
Views: 4342

Frank and Thomas,
I only use the run stack window for tracing backwards which predicates were executed before I got to the current breakpoint. I have not been able to follow/interpret/use the many graphics accompanying each entry in that window.
by Peter Muraya
18 Sep 2015 6:20
Forum: Visual Prolog
Topic: List::map and list:forall - shall I forget them?
Replies: 3
Views: 4195

Frank, My simple understanding is that the list comprehension, [||], replaced findall . list::map and list::forall are additions that if they commonly appear in your code they are neater to use (and understand) than the equivalent coded using foreach. See the following examples.... ...using list::ma...
by Peter Muraya
18 Sep 2015 5:50
Forum: Visual Prolog
Topic: Universal Quantification
Replies: 21
Views: 12112

Thomas and Martin, I'm always learning something new from his forum. cut-fail-negation ... that is news to me. It has helped me understand the following construct which at first was not obvious. not (( Gen, not(DetermBody) )) You hope that this sort of thing does not happen a lot in your code; other...
by Peter Muraya
17 Sep 2015 5:43
Forum: Visual Prolog
Topic: Universal Quantification
Replies: 21
Views: 12112

Martin, I thought about this a little bit more and found out why you did not understand the dynamic cuts in my code. In the first case, I was not really modelling foreach_() as currently implemented by the foreach/do construct. Your implementation is the correct one. I revisited the for forAll_() wi...
by Peter Muraya
17 Sep 2015 5:17
Forum: Visual Prolog
Topic: Nested foreach
Replies: 8
Views: 4566

Thanks Martin
So, you are using programControl::getBackTrackPoints() for optimization purporses; do you ever use it for other reasons?