I want to quickly create a structure in Picat. But the components of the structure should be evaluated when creating the structure. So far I tried, which gives me a structure when the components are already constants:
Picat 2.0b5, (C) picat-lang.org, 2013-2016.
Picat> X = $point(2,3).
X = point(2,3)
yes
But the following doesn't work, i.e. components that should be evaluated. I am expecting as a result X = point(3,12), but it doesn't give this result:
Picat> X = $point(1+2,3*4).
X = point(1 + 2,3 * 4)
yes
What is the shortest way to do that? It seems that the Picat ($)/1 operator is like lisp quote operator and it prevents Picat evaluation. What remains is Prolog unification. Here are some examples of Prolog unification in Picat:
Picat> $point(X,Y) = $point(1+2,3*4).
X = 1 + 2
Y = 3 * 4
yes
Picat> $point(X+Y,Z) = $point(1+2,3*4).
X = 1
Y = 2
Z = 3 * 4
yes
Picat> $X = $point(1+2,3*4).
X = point(1 + 2,3 * 4)
yes
As in Prolog expressions such as 1+2 and 3*4 are not evaluated inside ($)/1. Maybe its impossible to have evaluating constructors in Picat, similarly they are not found in standard Prolog at the moment.