Jump to content

Documentation: Difference between revisions

Added Logtalk example.
(Added Erlang)
(Added Logtalk example.)
Line 587:
}
}</lang>
 
=={{header|Logtalk}}==
Logtalk provides a set of entity and predicate documenting directives. The content of these and other directives can be retrieved using the language reflection features. A companion tool, "lgtdoc", uses the reflection API to extract the documenting information and export it as XML files and provides a set of stylesheets to convert these file to e.g. HTML and PDF files.
 
<lang logtalk>
:- object(set(_Type),
extends(set)).
 
% the info/1 directive is the main directive for documenting an entity
% its value is a list of Key-Value pairs; the set of keys is user-extendable
:- info([
version is 1.2,
author is 'A. Coder',
date is 2013/10/13,
comment is 'Set predicates with elements constrained to a single type.',
parnames is ['Type']
]).
 
% the info/2 directive is the main directive for documenting predicates
% its second value is a list of Key-Value pairs; the set of keys is user-extendable
:- public(intersection/3).
:- mode(intersection(+set, +set, ?set), zero_or_one).
:- info(intersection/3, [
comment is 'Returns the intersection of Set1 and Set2.',
argnames is ['Set1', 'Set2', 'Intersection']
]).
 
...
 
:- end_object.
</lang>
 
=={{header|Mathematica}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.