Search found 335 matches

by Harrison Pratt
5 Apr 2021 22:07
Forum: Visual Prolog
Topic: subset between sets
Replies: 2
Views: 153

Re: subset between sets

Classical way, easy to understand: class predicates isSubSet : (T* CheckTerms, T* Terms) determ. clauses isSubset([H], Terms) :- list::isMember(H, Terms), !. isSubset([H | TT], Terms) :- list::isMember(H, Terms), isSubSet(TT, Terms). Another way using VIP list class predicates. Put your cursor on &q...
by Harrison Pratt
5 Apr 2021 10:29
Forum: Visual Prolog
Topic: How to check existence of an object
Replies: 5
Views: 196

Re: How to check existence of an object

nothing(...) does nothing. It's a way of making the IDE capture an unused variable so you can see it when running the debugger. Unused variables do not consistently display in the Variables window when debugging without making them appear as being used to the compiler. It has no place in production...
by Harrison Pratt
4 Apr 2021 15:28
Forum: Visual Prolog
Topic: How to check existence of an object
Replies: 5
Views: 196

Re: How to check existence of an object

One way would be to create a class database in your base class and store the object identifier information you need in that database when you create each object, something like that below. You will need to manage removing personObj/2 facts when objects are destroyed and you also should remember that...
by Harrison Pratt
3 Apr 2021 11:36
Forum: Visual Prolog
Topic: How to approach fuzzy match
Replies: 3
Views: 184

Re: How to approach fuzzy match

domains myDomain = good; bad; ok. myDomainList = myDomain*. class facts myFactDB : (myDomain VarA, myDomain VarB, myDomain VarC, myDomain VarD). class predicates getMatchN_nd : (integer Count, myDomainList TestList) -> myDomainList MatchingValues nondeterm. clauses getMatchN_nd(N, TestList) = FactV...
by Harrison Pratt
27 Mar 2021 21:07
Forum: Visual Prolog
Topic: writef not printing to Message Window
Replies: 6
Views: 349

Re: writef not printing to Message Window

You can use vpi::processEvents() to force immediate output to the Messages window.

Code: Select all

... % do some processing someProcessingPredicate(), stdio::write("\nSomething happens here!"), _=vpi::processEvents(), % more processing ...
This may slow down processing so use it judiciously.
by Harrison Pratt
27 Mar 2021 17:17
Forum: Visual Prolog
Topic: Predicate called from menu must be a procedure (?)?
Replies: 3
Views: 233

Re: Predicate called from menu must be a procedure (?)?

One way is the catch any failure of startExperiment() so it does not fail, although that may not be what you want to do: clauses runExperiment() :- startExperiment(), ! or succeed. or you can catch failure in runExperiment() , although that may not be what you want to do either: clauses runExperimen...
by Harrison Pratt
25 Mar 2021 12:00
Forum: Visual Prolog
Topic: From string to integer
Replies: 8
Views: 447

Re: From string to integer

This would be a good time to learn how to use the debugger and walk through the code as it executes. Put your cursor on the line with culc(In) in your run clause and press F9 to set a breakpoint. Then press F5 (or click the single green triangle on the toolbar) to run the code in the debugger. Press...
by Harrison Pratt
24 Mar 2021 12:03
Forum: Visual Prolog
Topic: writef not printing to Message Window
Replies: 6
Views: 349

Re: writef not printing to Message Window

Can you post some of the relevant code? Remember that you should format code in this forum using the [</>] button in the forums editor. It is a better practice to put the bulk of your code in a class other than main.pro or taskwindow.pro and invoke those class predicates from taskwindow.pro , but I ...
by Harrison Pratt
21 Mar 2021 15:30
Forum: Visual Prolog
Topic: Beginner question - declare class facts across packages
Replies: 2
Views: 209

Re: Beginner question - declare class facts across packages

Facts can be declared only in a class's implementation ( .pro file) so you cannot make the facts themselves visible outside that class. However, you can easily put predicate definitions to manipulate those facts in the class's .cl file or .i file(s) to make them accessible from other classes as in t...
by Harrison Pratt
17 Jan 2021 4:00
Forum: Visual Prolog
Topic: What does [out] mean?
Replies: 3
Views: 622

Re: What does [out] mean?

The default specification for predicate definitions is [in], so you don't need to specify that a parameter is an input. You may be surprised to see that the IDE will change a valid definition like this: demoPred : (integer Input , string Output) (i,o). to this preferred form: demoPred : (integer Inp...
by Harrison Pratt
16 Jan 2021 18:22
Forum: Visual Prolog
Topic: What does [out] mean?
Replies: 3
Views: 622

Re: What does [out] mean?

[out] indicates that a value is returned from the predicate. For example: class predicates demoPred : (integer Input, string Output [out]). clauses demoPred(Input, OutPut) :- if Input < 0 then OutPut = "Negative" elseif Input = 0 then OutPut = "Zero" else OutPut = "Positive&...
by Harrison Pratt
12 Dec 2020 15:56
Forum: Visual Prolog
Topic: string::wrapString/4 documentation
Replies: 0
Views: 862

string::wrapString/4 documentation

wrapString : (string String, charCount HyphenLength, charCount MaxLength, string Indent) -> string* Lines. % @short % @detail #HyphenLength <= #MaxLength % @example % % All the statements below succeed: % ["123456","7890"] = string::wrapString("1234567890", 6, 6, "...
by Harrison Pratt
23 Nov 2020 16:57
Forum: Visual Prolog
Topic: Dynamically change font in projectToolbar Static Text
Replies: 0
Views: 947

Dynamically change font in projectToolbar Static Text

Is there a way to dynamically change the font in the projectToolbar beyond the options in the IDE wizard? I can change the text of the Static Text and can dynamically change a listButton's strings and font, but cannot figure out how to change the Text font. onTest(_Source, _MenuTag) :- vpiToolbar::g...
by Harrison Pratt
22 Nov 2020 21:15
Forum: Visual Prolog
Topic: Upgrade of CGI application
Replies: 5
Views: 1373

Re: Upgrade of CGI application

That is beyond my expertise, unfortunately.
by Harrison Pratt
22 Nov 2020 17:40
Forum: Visual Prolog
Topic: Upgrade of CGI application
Replies: 5
Views: 1373

Re: Upgrade of CGI application

cgi::init(stream::ansi(core:: ansi)),

Perhaps you want core::threadAnsi