Search found 1195 matches

by Thomas Linder Puls
19 Apr 2021 9:02
Forum: Visual Prolog
Topic: VIP Version 10!
Replies: 1
Views: 42

Re: VIP Version 10!

Nice to hear about good results.

It is a bug that 1 << 32 does not work as expected. You have reported this before, but it must have escaped my mind; it will be fixed in the next release (this time I have made the necessary change).
by Thomas Linder Puls
6 Apr 2021 11:37
Forum: Visual Prolog
Topic: making predicates procedures - single facts?
Replies: 1
Views: 137

Re: making predicates procedures - single facts?

single facts are automatically retracted when a new fact is asserted.

But in general I think you should use fact variables:

Code: Select all

facts     someValue : integer := 2.
See also Facts, and it is also a good idea to follow the tutorials.
by Thomas Linder Puls
4 Apr 2021 13:34
Forum: Visual Prolog
Topic: introspection
Replies: 8
Views: 435

Re: introspection

Considering what I think you ask the short answer is no . Assume this: interface window ... end interface window interface control supports window ... end interface control class textControl : control ... end class textControl We have a class textControl which constructs objects of the interface typ...
by Thomas Linder Puls
28 Mar 2021 20:28
Forum: Visual Prolog
Topic: introspection
Replies: 8
Views: 435

Re: introspection

A typeLibrary is a runtime representation of a type, it is only documented in form of the corresponding interface ($(ProDir)\pfc\reflection\typeLibrary\typeLibrary.i).

Type libraries are used heavily behind the scenes to make polymorphism work. But I doubt that you will need it for anything.
by Thomas Linder Puls
28 Mar 2021 20:14
Forum: Visual Prolog
Topic: writef not printing to Message Window
Replies: 6
Views: 345

Re: writef not printing to Message Window

While vpi::processEvents will help to update the windows, it will also allow users to press on menu-entries, buttons, etc. So it may mix other processing in the "current" one, hence it has many aspects in common with multi-threaded programming or (more precisely) coroutines and asynchronou...
by Thomas Linder Puls
28 Mar 2021 14:06
Forum: Visual Prolog
Topic: Predicate called from menu must be a procedure (?)?
Replies: 3
Views: 226

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

You can also use orelse:

Code: Select all

clauses      runExperiment() :-          startExperiment() orelse succeed.
by Thomas Linder Puls
24 Mar 2021 18:27
Forum: Visual Prolog
Topic: From string to integer
Replies: 8
Views: 436

Re: From string to integer

Sorry, I typed the wrong predicate, it should be:

Code: Select all

Number = tryToTerm(integer, String)
by Thomas Linder Puls
24 Mar 2021 15:44
Forum: Visual Prolog
Topic: From string to integer
Replies: 8
Views: 436

Re: From string to integer

Given that the format match that of a Visual Prolog number you can use:

Code: Select all

Number = tryConvert(integer, String)
where integer could instead be for example real.
by Thomas Linder Puls
24 Mar 2021 15:39
Forum: Visual Prolog
Topic: introspection
Replies: 8
Views: 435

Re: introspection

The build-in predicate typeLibraryOf can give you the typeLibrary of any term. That will give you the type which it has "here" But it seems you are looking for the construction type and that can unfortunately not be found by reflection/introspection. But if you have a suspicion about the t...
by Thomas Linder Puls
24 Mar 2021 13:35
Forum: Visual Prolog
Topic: writef not printing to Message Window
Replies: 6
Views: 345

Re: writef not printing to Message Window

Please read about [code] ... [/code] formatting in the forum guides.
by Thomas Linder Puls
21 Mar 2021 19:52
Forum: Visual Prolog
Topic: introspection
Replies: 8
Views: 435

Re: introspection

I m not sure I understand what you mean, perhaps you could give more details?
by Thomas Linder Puls
18 Mar 2021 18:13
Forum: Visual Prolog
Topic: Einstein's Riddle
Replies: 3
Views: 267

Re: Einstein's Riddle

The brief answer is: You cannot use this code in Visual Prolog. (You can however (I guess/believe) run it in our PIE program (Prolog Interpreter Engine), which is an example program comes with Visual Prolog that implements a classical Prolog system much closer to ISO Prolog). I don't know how much o...
by Thomas Linder Puls
16 Mar 2021 13:36
Forum: Visual Prolog
Topic: Implementing a property using a fact
Replies: 2
Views: 247

Re: Implementing a property using a fact

I guess that you didn't declare the fact variable in the implementation:

Code: Select all

implement slot ... class facts     aDiagram : ... ... end implement slot
by Thomas Linder Puls
14 Mar 2021 21:07
Forum: Visual Prolog
Topic: Example for removeAllBy
Replies: 5
Views: 469

Re: Example for removeAllBy

The predicate removeAllBy is used when you want to supply your own comparison routine. For strings it could for example (as above) be a comparison that consider uppercase and lowercase letters the same. But for numbers it would (almost always) be natural to use the normal number comparison. clauses ...