Prolog: ERROR: Undefined procedure: getval/2 How to use getval? - prolog

I set the values of two variables in the first two lines of my code. However when I want to retrieve the values of them later using getval, I got the error ERROR: Undefined procedure: getval/2. What's wrong?

Related

Finding arguments of a function call gimple statement

gimple_call_num_args(stmt) on my statement gives 2 but get_name(gimple_call_arg(stmt,1)) is null. Any ideas on how to get the arguments?

Why am I getting existence error when trying to remove doubles from a list?

Why am I getting existence error here, specifically:
uncaught exception: error(existence_error(procedure,list_append/2),noDoubles/2)
I would like to remove doubles from a list and I tried using the 'if' from prolog.
list_append(X,[],[X]).
list_append(X,L1,[X|L1]).
noDoubles([X],[X]).
noDoubles([H|T],L1):- (member(H,T) -> noDoubles(T,L1);(list_append(H,L1),noDoubles(T,L1))).
I have prolog 1.4.4
You've defined list_append with arity 3, and you're calling list_append predicate with arity 2.

Prolog Why is the multiplication symbol * an undefined procedure?

I am trying to do simple two number multiplication in Prolog. When I initially launch Prolog without loading any file, I am able to type in:
X is 2 * 2.
And I get 4 as the answer. But when I launch Prolog by opening my file with my code, the above statement does not work anymore. It says:
ERROR: toplevel: Undefined procedure: (*)/2 (DWIM could not correct goal)
And when I load my code I get the following:
Warning: The predicates below are not defined. If these are defined
Warning: at runtime using assert/1, use :- dynamic Name/Arity.
Warning:
Warning: */2, which is referenced by
Warning: c:/filepath/project.pl:98:21: 1-st clause of multiply/3
Why does the multiplication work when I don't load my code, but not work when I load my code? This is part of the code I am using for multiplication:
:-dynamic(multiply/3).
multiply(X, Y, Z) :- Z is X * Y.
The two lines above are the only mentions of multiply in my code.
I have spent a couple hours searching for answers and failed. Maybe my keywords I use to search are not specific enough, but it's difficult to find Prolog answers as it is. Am I doing something wrong? This issue is the only thing preventing me from finishing my project, which is too long to be of good use if posted.
Part of our project was to modify code given by the Professor. The Prof included the following line that was not being used anywhere:
:-op(150,xfx,is).
When removed, the 'is' in:
X is 2 * 2.
works and displays the correct answer.

Type Mismatch error on WAIT?

This one is making me a little crazy and I hope someone can help.
I added a wait(45) line to my QTP script and when it runs I get a type mismatch error.
I know this will occur if a function can't be called or I misspell something to be called or etc.
But, this is a simple WAIT statement. Nothing else on the line.
Line: 152
Char: 6
Error: Type mismatch: 'Wait'
Code 800A000D
Any ideas? Did I miss something? How can there be a type mismatch on Wait?
There definitely is no Wait() sub or function in VBScript; as this question indicates, this holds for QTP too.
As to the error: a missing sub/function throws a type mismatch:
>> nosuchsub
>>
Error Number: 13
Error Description: Type mismatch
(If this consoles you, I don't like it neither.)
Actual error is not in Wait function. QTP shows type mismatch error due to compilation error in previous lines. Check all your library files are properly added. Best method to find the root cause of problems like this is to divide your code into smaller functions / procedures and test each function.

Undefined arguments(Image Processing)

I am having a little problem here. In the code below is a function that has two arguments when I attempt to execute the functions i obtained this error
Undefined function or method for input
arguments of type 'double' (X,CX) as shown in (1).
the function is coded as below
[CX,sse]= (vgg_kmiter(X, CX)) ....(1)
can someone point me out where is the problem with this code?
note that the x is the input points in a columns which is integer and the CX is the center of clustering which is also integer.
Thank you
[CX,sse]= (vgg_kmiter(X, CX)) ....(1)
Is not a valid line of code.
[CX,sse]= (vgg_kmiter(X, CX));
is fine, though the outer parentheses aren't needed.
[CX,sse]= (vgg_kmiter(X, CX)) %....(1)
is fine as well - everything after the % sign is considered a comment

Resources