I do not understand the following Prolog snippet?
What does ":_:"
mean? What is the difference between ":="
and "="
?
game_to_problematic_points(Game,Pid,Hid) :-
Point := Game/point,
Pid := Point@id,
Point = point:_:Hits.
append(_, [Hit1,_|_], Hits),
hit_out(Hit1),
Hid := Hit1@id.
hit_out(Hit) :-
X := Hit@x,
Y := Hit@y,
( X > 23.77 / 2
; X < -23.77 / 2
; Y > 10.97 / 2
; Y < -10.97 / 2).
Thanks :)
This seems to be XPCE code. XPCE is the native SWI-Prolog object-oriented GUI library. You can find its manual in PDF format at:
http://www.swi-prolog.org/download/xpce/doc/userguide/userguide.pdf
The :=/2
operator is used for assignment (see the guide for details) while the =/2
is the standard Prolog unification operator.
The goal Point = point:_:Hits
is simply the unification of the variable Point
with the compound term point:_:Hits
. It may be clear if you write this term in canonical form:
?- write_canonical(point:_:Hits).
:(point,:(_,_))
true.
Note that this term uses the standard :/2
module operator twice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With