Hyperlinks
[
Front page
|
List of pages
|
Search
|
Recent changes
|
Backup
|
Help
]
Start:
//[[Documentation]]
*Hyperlinks and hypergraphs [#se1fd52b]
LMNtal links represent point-to-point connection between ...
Accordingly, LMNtal now provides the syntax and operation...
**Creating a hyperlink [#hcd901f8]
A hyperlink is created by a ''new'' construct specified i...
hoge.
hoge :- new($h) | a($h), b($h).
Since each hyperlink can be regarded as a unary atom with...
Another view of hyperlinks is a generalization of ordinar...
hoge.
hoge :- a(!H), b(!H).
or just
a(!H), b(!H).
The result of all the above programs will be
a(!H4), b(!H4).
That is, a hyperlink will be printed as a '!H' followed b...
**Type checking [#i375b878]
The type constraint ''hlink''($x) checks if $x represents...
main.
main :- new($x) | a($y).
a($x) :- hlink($x) | b($x,$x).
or
a(!Y).
a(!X) :- b(!X,!X).
Result:
b(!H4,!H4).
**Equality checking [#gd567c1c]
Since an occurrence of a hyperlink is regarded as a unary...
a($x), b($y) :- hlink($x), hlink($y), $x == $y | ok.
The above rule can be written also as
a($x), b($x) :- ok.
or
a(!X), b(!X) :- ok.
**Fusing two hyperlinks [#e554f0f3]
Two hyperlinks can be fused into one using the "''><''" o...
main.
main :- new($x), new($y) | a($x), b($z).
a($x), b($y) :- $x \== $y | ab($x,$y), $x >< $y.
or
a(!X), b(!Z).
a(!X), b(!Y) :- !X \== !Y | ab(!X,!Y), !X >< !Y.
If $x and $y represent different hyperlinks (i.e., have d...
**Number of occurrences [#hc2d2626]
The ''num'' construct in a guard will return the number o...
main.
main :- new($x) | a($x), b($x).
a($h) :- $n = num($h) | occurrences($n).
or
a(!X), b(!X).
a(!H) :- $n = num(!H) | occurrences($n).
Result:
b(!H4), occurrences(2).
Another use:
a(!X).
a(!H) :- num(!H) < 5 | a(!H), a(!H).
Result:
a(!H4), a(!H4), a(!H4), a(!H4), a(!H4).
Yet another use:
flag(!X), a(!X), a(!X), a(!X), a(!X), a(!X).
a(!H) :- .
flag(!H) :- num(!H) =:= 1 | ok.
Result:
ok. // ok is created when all a(!H1)'s are removed
In this way, using hyperlinks, one can check the '''absen...
*How to use [#nade49a7]
**LaViT [#qcec53b9]
When you execute your program under LaViT (recommended), ...
- Compile Option: ''--slimcode'' and ''--hl-opt''
- Slim Option: ''--hl''
Please see below for the details of those options.
**Compiling [#nd78cdd2]
Currently, programs with hyperlinks can be executed only ...
lmntal --slimcode --hl hoge.lmn > hoge.il
- ''--hl'' : turn on hyperlinks.
- ''--hl-opt'' : turn on hyperlinks and optimize graph ma...
**Execution [#aff38a8e]
Specify ''--hl'' when running SLIM, e.g.,
slim --hl --show-hl hoge.il
- ''--hl'' : turn on hyperlinks.
- ''--show-hl'' : prints the details of hyperlinks.
-- Without this option, different occurrences of a hyperl...
-- With this option, each occurrence of a hyperlink is pr...
End:
//[[Documentation]]
*Hyperlinks and hypergraphs [#se1fd52b]
LMNtal links represent point-to-point connection between ...
Accordingly, LMNtal now provides the syntax and operation...
**Creating a hyperlink [#hcd901f8]
A hyperlink is created by a ''new'' construct specified i...
hoge.
hoge :- new($h) | a($h), b($h).
Since each hyperlink can be regarded as a unary atom with...
Another view of hyperlinks is a generalization of ordinar...
hoge.
hoge :- a(!H), b(!H).
or just
a(!H), b(!H).
The result of all the above programs will be
a(!H4), b(!H4).
That is, a hyperlink will be printed as a '!H' followed b...
**Type checking [#i375b878]
The type constraint ''hlink''($x) checks if $x represents...
main.
main :- new($x) | a($y).
a($x) :- hlink($x) | b($x,$x).
or
a(!Y).
a(!X) :- b(!X,!X).
Result:
b(!H4,!H4).
**Equality checking [#gd567c1c]
Since an occurrence of a hyperlink is regarded as a unary...
a($x), b($y) :- hlink($x), hlink($y), $x == $y | ok.
The above rule can be written also as
a($x), b($x) :- ok.
or
a(!X), b(!X) :- ok.
**Fusing two hyperlinks [#e554f0f3]
Two hyperlinks can be fused into one using the "''><''" o...
main.
main :- new($x), new($y) | a($x), b($z).
a($x), b($y) :- $x \== $y | ab($x,$y), $x >< $y.
or
a(!X), b(!Z).
a(!X), b(!Y) :- !X \== !Y | ab(!X,!Y), !X >< !Y.
If $x and $y represent different hyperlinks (i.e., have d...
**Number of occurrences [#hc2d2626]
The ''num'' construct in a guard will return the number o...
main.
main :- new($x) | a($x), b($x).
a($h) :- $n = num($h) | occurrences($n).
or
a(!X), b(!X).
a(!H) :- $n = num(!H) | occurrences($n).
Result:
b(!H4), occurrences(2).
Another use:
a(!X).
a(!H) :- num(!H) < 5 | a(!H), a(!H).
Result:
a(!H4), a(!H4), a(!H4), a(!H4), a(!H4).
Yet another use:
flag(!X), a(!X), a(!X), a(!X), a(!X), a(!X).
a(!H) :- .
flag(!H) :- num(!H) =:= 1 | ok.
Result:
ok. // ok is created when all a(!H1)'s are removed
In this way, using hyperlinks, one can check the '''absen...
*How to use [#nade49a7]
**LaViT [#qcec53b9]
When you execute your program under LaViT (recommended), ...
- Compile Option: ''--slimcode'' and ''--hl-opt''
- Slim Option: ''--hl''
Please see below for the details of those options.
**Compiling [#nd78cdd2]
Currently, programs with hyperlinks can be executed only ...
lmntal --slimcode --hl hoge.lmn > hoge.il
- ''--hl'' : turn on hyperlinks.
- ''--hl-opt'' : turn on hyperlinks and optimize graph ma...
**Execution [#aff38a8e]
Specify ''--hl'' when running SLIM, e.g.,
slim --hl --show-hl hoge.il
- ''--hl'' : turn on hyperlinks.
- ''--show-hl'' : prints the details of hyperlinks.
-- Without this option, different occurrences of a hyperl...
-- With this option, each occurrence of a hyperlink is pr...
Page: