Did you know ... Search Documentation:
Title for wiki('Annotation--annotation')
0 upvotes 0 0 downvotes
Picture of user LogicalCaptain.

Special case: When you create a module to host dict method calls, you don't list those in the "public list" section:

Here, just the predicate is listed:

:- module(point, [point_length/2]).

M.multiply(F)                           % Method ".multiply/1" on dict M
   := point{x:X, y:Y}                   % Returns a "point" dict
   :- X is M.x*F, Y is M.y*F.           % Body where dict M is accessible

M.len()                                 % Method ".len/0" on dict M
   := Len                               % Returns a "Len" value (a number, actually)
   :- Len is sqrt(M.x**2 + M.y**2),     % Body where dict M is accessible
      debug("pointlength_method","~q.len() = ~q",[M,Len]).
      
point_length(point{x:X,y:Y},Len) :-
   Len is sqrt(X**2 + Y**2),
   debug("pointlength_predicate","point{x:~q,y:~q} = ~q",[X,Y,Len]).