Prolog: How can I implement the sum of squares of two largest numbers out of three?
问题 Exercise 1.3 of the book Structure and Interpretation of Computer Programs asks the following: Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers. I'm learning Prolog. Here's the function I tried to implement: square(X, Y) :- Y is X * X. squareTwoLargest(X, Y, Z, R) :- R is square(L1) + square(L2), L1 = max(X, Y), L2 = max(min(X, Y), Z). However, when I run it, it gives the following error: ERROR: is/2: Arguments are not