Search found 285 matches

by Martin Meyer
21 Apr 2021 16:16
Forum: Visual Prolog
Topic: Updating to VIP 10
Replies: 2
Views: 29

Re: Updating to VIP 10

Maybe the access violation in 32-bit mode of VIP 10 in this construction goes back to same cause: implement main open core class predicates doNothing : (Type) where Type supports unsigned16. clauses doNothing(X) :- doNothing_1(X, X). class predicates doNothing_1 : (Type A, unsigned16 B) where Type s...
by Martin Meyer
20 Apr 2021 23:48
Forum: Visual Prolog
Topic: Updating to VIP 10
Replies: 2
Views: 29

Updating to VIP 10

Hello Thomas, on updating my code to new VIP 10 the compiler has complained at some surprising places. When I inspected these places in detail, I found that there were bugs in my code which the 9.0.6 compiler (and me) had not noticed before. Apparently the polymorphic type checking has become smarte...
by Martin Meyer
25 Mar 2021 20:46
Forum: Visual Prolog
Topic: From string to integer
Replies: 8
Views: 444

Re: From string to integer

Correct, integers can be negative. The language accepted in the example is but extremely simple. It accepts only number literals without leading signs. Optional leading signs would make the example more complicated. Signed numbers are usually implemented in parsers through unary functions " - &...
by Martin Meyer
25 Mar 2021 14:00
Forum: Visual Prolog
Topic: From string to integer
Replies: 8
Views: 444

Re: From string to integer

Yes, walk through the code by the debugger. Study the VIP Language Reference and tutorials. Doing so you will quickly become used to write programs in VIP. One way to jump to required blocks depending on the expression would be (including some beautification): implement main class predicates tryCalc...
by Martin Meyer
19 Mar 2021 1:30
Forum: Visual Prolog
Topic: Einstein's Riddle
Replies: 3
Views: 268

Re: Einstein's Riddle

An add-on remark from me: ISO Prolog style variables formerly had the type of "reference domains" in Visual Prolog. Thomas explains a way in which these variables can be emulated in current Visual Prolog in the Tutorial How To Remove Reference Domains from a Project . By the method explain...
by Martin Meyer
2 Nov 2020 16:26
Forum: Visual Prolog
Topic: Questions about family 1
Replies: 2
Views: 1259

Re: Questions about family 1

Hello Bo Cong, the pictures you have posted do not match. The 1st one shows an exe directory containing the usual files. In the 2nd pic the exe directory seems to be messed up: The usual files are missing and *.pack and *.ph files should better not be placed in the exe (= "executables") di...
by Martin Meyer
4 Jul 2020 10:31
Forum: Visual Prolog
Topic: Question about example in A Beginner's Guide to Visual Prolog
Replies: 8
Views: 3532

Re: Question about example in A Beginner's Guide to Visual Prolog

The recursion is not the relevant point for your question " how do outputs propagate ". When I remove the recursion from the example, the "propagation" becomes more obvious. The situation of the outermost call then is: class predicates add1 : (integer*, integer* [out]). clauses a...
by Martin Meyer
4 Jul 2020 2:16
Forum: Visual Prolog
Topic: Question about example in A Beginner's Guide to Visual Prolog
Replies: 8
Views: 3532

Re: Question about example in A Beginner's Guide to Visual Prolog

What you call "assignment" and "comparison" is in Visual Prolog (and any Prolog) accomplished by nothing else but the unification of terms. Formally speaking: A variable can be, and can only be, bound by a unification of terms. A unification can succeed or fail. Binding a variabl...
by Martin Meyer
3 Jul 2020 14:29
Forum: Visual Prolog
Topic: Replace nulls in ::string
Replies: 6
Views: 3118

Re: Replace nulls in ::string

@Chris: For the learning curve check the implementation of fromMsStringSeq/1-> in windowsAPI.pro, it is done there more efficient than in my code.
by Martin Meyer
3 Jul 2020 13:59
Forum: Visual Prolog
Topic: Replace nulls in ::string
Replies: 6
Views: 3118

Re: Replace nulls in ::string

ah, thank you Thomas! So, we should do it like class predicates getLogicalDriveStrings : (charCount BufLen, unsigned Result [out]) -> string_list Str_list. clauses getLogicalDriveStrings(BufLen, Result) = windowsAPI::fromMsStringSeq(uncheckedConvert(windowsAPI::msStringSeq, Buf)) :- Buf = memory::al...
by Martin Meyer
2 Jul 2020 18:41
Forum: Visual Prolog
Topic: Replace nulls in ::string
Replies: 6
Views: 3118

Re: Replace nulls in ::string

Maybe there is a problem in memory::getString/2-> . Because when I replaced it by my own version, it has worked out: open core class predicates getLogicalDriveStrings : (charCount BufLen, unsigned Result [out]) -> string_list Str_list. clauses getLogicalDriveStrings(BufLen, Result) = getLogicalDrive...
by Martin Meyer
30 Jun 2020 22:18
Forum: Visual Prolog
Topic: Question about example in A Beginner's Guide to Visual Prolog
Replies: 8
Views: 3532

Re: Question about example in A Beginner's Guide to Visual Prolog

To track the computation you could (besides using the debugger) simply insert calls to write into the code which will produce a 'log'. To try that paste the below in file main.pro of a new console project: class listmanager predicates add1 : (integer*, integer* [out]). end class listmanager %--- imp...
by Martin Meyer
30 Jun 2020 17:13
Forum: Visual Prolog
Topic: Question about example in A Beginner's Guide to Visual Prolog
Replies: 8
Views: 3532

Re: Question about example in A Beginner's Guide to Visual Prolog

That means, variables can be bound solely through the head of a called clause, without having to use " = ". Like for example in: class predicates inverse : (integer, integer [out]). clauses inverse(Num, -Num). clauses run() :- inverse(3, X), stdio::write("X = ", X). Predicate inv...
by Martin Meyer
30 Jun 2020 16:43
Forum: Visual Prolog
Topic: Question about example in A Beginner's Guide to Visual Prolog
Replies: 8
Views: 3532

Re: Question about example in A Beginner's Guide to Visual Prolog

The conceptual behavior, which Thomas has explained in particular, is also described in the Language Reference in general. It often helps me to look up things there. The reference says that unification takes place in two different situations: When a predicate is called the arguments from the call ar...
by Martin Meyer
4 Jun 2020 13:03
Forum: Visual Prolog
Topic: Prolog - school project
Replies: 1
Views: 2564

Re: Prolog - school project

Hi Kim, very different Prolog implementations exist. Only some of them are modular within a framework of object-oriented programming. Visual Prolog gives a fine example of objects and modules in a programming language. It comes with a programming environment for developing programs. The environment ...