-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the Logtalk language
- Loading branch information
Showing
9 changed files
with
419 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
tests/data/notebooks/inputs/ipynb_logtalk/logtalk_notebook.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# An implementation of the Ackermann function" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"vscode": { | ||
"languageId": "logtalk" | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"\u001b[1mtrue" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"%%load ack.lgt\n", | ||
"\n", | ||
":- object(ack).\n", | ||
"\n", | ||
":- info([\n", | ||
"\tversion is 1:0:0,\n", | ||
"\tauthor is 'Paulo Moura',\n", | ||
"\tdate is 2008-3-31,\n", | ||
"\tcomment is 'Ackermann function (general recursive function).'\n", | ||
"]).\n", | ||
"\n", | ||
":- public(ack/3).\n", | ||
":- mode(ack(+integer, +integer, -integer), one).\n", | ||
":- info(ack/3, [\n", | ||
"\tcomment is 'Ackermann function.',\n", | ||
"\targnames is ['M', 'N', 'V']\n", | ||
"]).\n", | ||
"\n", | ||
"ack(0, N, V) :-\n", | ||
"\t!,\n", | ||
"\tV is N + 1.\n", | ||
"ack(M, 0, V) :-\n", | ||
"\t!,\n", | ||
"\tM2 is M - 1,\n", | ||
"\tack(M2, 1, V).\n", | ||
"ack(M, N, V) :-\n", | ||
"\tM2 is M - 1,\n", | ||
"\tN2 is N - 1,\n", | ||
"\tack(M, N2, V2),\n", | ||
"\tack(M2, V2, V).\n", | ||
"\n", | ||
":- end_object." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Sample query" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"vscode": { | ||
"languageId": "logtalk" | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"\u001b[1mV = 11" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"ack::ack(2, 4, V)." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Logtalk", | ||
"language": "logtalk", | ||
"name": "logtalk_kernel" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": "logtalk", | ||
"file_extension": ".lgt", | ||
"mimetype": "text/x-logtalk", | ||
"name": "Logtalk" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
50 changes: 50 additions & 0 deletions
50
tests/data/notebooks/outputs/ipynb_to_Rmd/logtalk_notebook.Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
jupyter: | ||
kernelspec: | ||
display_name: Logtalk | ||
language: logtalk | ||
name: logtalk_kernel | ||
--- | ||
|
||
# An implementation of the Ackermann function | ||
|
||
```{logtalk vscode={'languageId': 'logtalk'}} | ||
%%load ack.lgt | ||
:- object(ack). | ||
:- info([ | ||
version is 1:0:0, | ||
author is 'Paulo Moura', | ||
date is 2008-3-31, | ||
comment is 'Ackermann function (general recursive function).' | ||
]). | ||
:- public(ack/3). | ||
:- mode(ack(+integer, +integer, -integer), one). | ||
:- info(ack/3, [ | ||
comment is 'Ackermann function.', | ||
argnames is ['M', 'N', 'V'] | ||
]). | ||
ack(0, N, V) :- | ||
!, | ||
V is N + 1. | ||
ack(M, 0, V) :- | ||
!, | ||
M2 is M - 1, | ||
ack(M2, 1, V). | ||
ack(M, N, V) :- | ||
M2 is M - 1, | ||
N2 is N - 1, | ||
ack(M, N2, V2), | ||
ack(M2, V2, V). | ||
:- end_object. | ||
``` | ||
|
||
## Sample query | ||
|
||
```{logtalk vscode={'languageId': 'logtalk'}} | ||
ack::ack(2, 4, V). | ||
``` |
50 changes: 50 additions & 0 deletions
50
tests/data/notebooks/outputs/ipynb_to_hydrogen/logtalk_notebook.lgt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
% --- | ||
% jupyter: | ||
% kernelspec: | ||
% display_name: Logtalk | ||
% language: logtalk | ||
% name: logtalk_kernel | ||
% --- | ||
|
||
% %% [markdown] | ||
% # An implementation of the Ackermann function | ||
|
||
% %% vscode={"languageId": "logtalk"} | ||
%%load ack.lgt | ||
|
||
:- object(ack). | ||
|
||
:- info([ | ||
version is 1:0:0, | ||
author is 'Paulo Moura', | ||
date is 2008-3-31, | ||
comment is 'Ackermann function (general recursive function).' | ||
]). | ||
|
||
:- public(ack/3). | ||
:- mode(ack(+integer, +integer, -integer), one). | ||
:- info(ack/3, [ | ||
comment is 'Ackermann function.', | ||
argnames is ['M', 'N', 'V'] | ||
]). | ||
|
||
ack(0, N, V) :- | ||
!, | ||
V is N + 1. | ||
ack(M, 0, V) :- | ||
!, | ||
M2 is M - 1, | ||
ack(M2, 1, V). | ||
ack(M, N, V) :- | ||
M2 is M - 1, | ||
N2 is N - 1, | ||
ack(M, N2, V2), | ||
ack(M2, V2, V). | ||
|
||
:- end_object. | ||
|
||
% %% [markdown] | ||
% ## Sample query | ||
|
||
% %% vscode={"languageId": "logtalk"} | ||
ack::ack(2, 4, V). |
50 changes: 50 additions & 0 deletions
50
tests/data/notebooks/outputs/ipynb_to_md/logtalk_notebook.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
jupyter: | ||
kernelspec: | ||
display_name: Logtalk | ||
language: logtalk | ||
name: logtalk_kernel | ||
--- | ||
|
||
# An implementation of the Ackermann function | ||
|
||
```logtalk vscode={"languageId": "logtalk"} | ||
%%load ack.lgt | ||
:- object(ack). | ||
:- info([ | ||
version is 1:0:0, | ||
author is 'Paulo Moura', | ||
date is 2008-3-31, | ||
comment is 'Ackermann function (general recursive function).' | ||
]). | ||
:- public(ack/3). | ||
:- mode(ack(+integer, +integer, -integer), one). | ||
:- info(ack/3, [ | ||
comment is 'Ackermann function.', | ||
argnames is ['M', 'N', 'V'] | ||
]). | ||
ack(0, N, V) :- | ||
!, | ||
V is N + 1. | ||
ack(M, 0, V) :- | ||
!, | ||
M2 is M - 1, | ||
ack(M2, 1, V). | ||
ack(M, N, V) :- | ||
M2 is M - 1, | ||
N2 is N - 1, | ||
ack(M, N2, V2), | ||
ack(M2, V2, V). | ||
:- end_object. | ||
``` | ||
|
||
## Sample query | ||
|
||
```logtalk vscode={"languageId": "logtalk"} | ||
ack::ack(2, 4, V). | ||
``` |
57 changes: 57 additions & 0 deletions
57
tests/data/notebooks/outputs/ipynb_to_myst/logtalk_notebook.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
kernelspec: | ||
display_name: Logtalk | ||
language: logtalk | ||
name: logtalk_kernel | ||
--- | ||
|
||
# An implementation of the Ackermann function | ||
|
||
```{code-cell} | ||
--- | ||
vscode: | ||
languageId: logtalk | ||
--- | ||
%%load ack.lgt | ||
:- object(ack). | ||
:- info([ | ||
version is 1:0:0, | ||
author is 'Paulo Moura', | ||
date is 2008-3-31, | ||
comment is 'Ackermann function (general recursive function).' | ||
]). | ||
:- public(ack/3). | ||
:- mode(ack(+integer, +integer, -integer), one). | ||
:- info(ack/3, [ | ||
comment is 'Ackermann function.', | ||
argnames is ['M', 'N', 'V'] | ||
]). | ||
ack(0, N, V) :- | ||
!, | ||
V is N + 1. | ||
ack(M, 0, V) :- | ||
!, | ||
M2 is M - 1, | ||
ack(M2, 1, V). | ||
ack(M, N, V) :- | ||
M2 is M - 1, | ||
N2 is N - 1, | ||
ack(M, N2, V2), | ||
ack(M2, V2, V). | ||
:- end_object. | ||
``` | ||
|
||
## Sample query | ||
|
||
```{code-cell} | ||
--- | ||
vscode: | ||
languageId: logtalk | ||
--- | ||
ack::ack(2, 4, V). | ||
``` |
50 changes: 50 additions & 0 deletions
50
tests/data/notebooks/outputs/ipynb_to_percent/logtalk_notebook.lgt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
% --- | ||
% jupyter: | ||
% kernelspec: | ||
% display_name: Logtalk | ||
% language: logtalk | ||
% name: logtalk_kernel | ||
% --- | ||
|
||
% %% [markdown] | ||
% # An implementation of the Ackermann function | ||
|
||
% %% vscode={"languageId": "logtalk"} | ||
% %%load ack.lgt | ||
|
||
:- object(ack). | ||
|
||
:- info([ | ||
version is 1:0:0, | ||
author is 'Paulo Moura', | ||
date is 2008-3-31, | ||
comment is 'Ackermann function (general recursive function).' | ||
]). | ||
|
||
:- public(ack/3). | ||
:- mode(ack(+integer, +integer, -integer), one). | ||
:- info(ack/3, [ | ||
comment is 'Ackermann function.', | ||
argnames is ['M', 'N', 'V'] | ||
]). | ||
|
||
ack(0, N, V) :- | ||
!, | ||
V is N + 1. | ||
ack(M, 0, V) :- | ||
!, | ||
M2 is M - 1, | ||
ack(M2, 1, V). | ||
ack(M, N, V) :- | ||
M2 is M - 1, | ||
N2 is N - 1, | ||
ack(M, N2, V2), | ||
ack(M2, V2, V). | ||
|
||
:- end_object. | ||
|
||
% %% [markdown] | ||
% ## Sample query | ||
|
||
% %% vscode={"languageId": "logtalk"} | ||
ack::ack(2, 4, V). |
Oops, something went wrong.