Search found 280 matches

by Martin Meyer
2 Nov 2020 16:26
Forum: Visual Prolog
Topic: Questions about family 1
Replies: 2
Views: 349

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") directory. C...
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: 2291

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 add1([], []). % this ...
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: 2291

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 variable to a value in a un...
by Martin Meyer
3 Jul 2020 14:29
Forum: Visual Prolog
Topic: Replace nulls in ::string
Replies: 6
Views: 1982

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: 1982

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: 1982

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: 2291

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: 2291

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 inverse /2 contains no ...
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: 2291

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: 1875

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 ...
by Martin Meyer
26 May 2020 21:39
Forum: Visual Prolog
Topic: Wishlist Item
Replies: 6
Views: 2943

Re: Wishlist Item

In my class bitAddOn I give all bit counts type positive or in some cases positiveOptional . For example I have predicates getLowBitPos64 : (unsigned64 X) -> positiveOptional BitPosition. % @short Returns the position of the lowest 1-bit % @end where a result of -1 means that there is no 1-bit in X ...
by Martin Meyer
24 May 2020 21:50
Forum: Visual Prolog
Topic: Domains specification in both .i and .cl files
Replies: 3
Views: 2199

Re: Domains specification in both .i and .cl files

Hello Harrison, defining domain expressionDOM in the face interface it works without the helper class: interface face domains expressionDOM = smiling; frowning. predicates setExpression : (expressionDOM). getExpression : () -> expressionDOM. end interface face %--- class face : face constructors new...
by Martin Meyer
22 May 2020 17:26
Forum: Visual Prolog
Topic: Wishlist Item
Replies: 6
Views: 2943

Re: Wishlist Item

I recommend however that you keep using the old style syntax for bitwise and boolean operators in build 905. The new syntax has an issue in 64bit mode which affects bitCount64/1-> . For example try this in 32bit and 64bit modes: constants m1 : unsigned64 = 0x5555555555555555. m2 : unsigned64 = 0x333...
by Martin Meyer
22 May 2020 15:15
Forum: Visual Prolog
Topic: Wishlist Item
Replies: 6
Views: 2943

Re: Wishlist Item

Hi choibakk, Wikipedia gives instructions how you can code a trailingZeroBits/1-> function for 64 bits: constants m1 : unsigned64 = 0x5555555555555555. m2 : unsigned64 = 0x3333333333333333. m4 : unsigned64 = 0x0F0F0F0F0F0F0F0F. class predicates bitCount64 : (unsigned64 Value) -> unsigned64 Count. cl...
by Martin Meyer
21 May 2020 18:11
Forum: Visual Prolog
Topic: Source file too large?
Replies: 5
Views: 5567

Re: Source file too large?

I happened to see another case of the issue in build 905. When I tried to save the changes in an implementation file I got exactly same error box as posted before. It seems the issue is provoked by certain amounts of lines and characters. I have constructed the attached dummy file TestFile.pro of ab...