From 2b2c2ba396d2a510f1a3e6386a0f2e6f452dd5cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christina=20S=C3=B8rensen?= <christina@cafkafk.com>
Date: Sun, 22 Dec 2024 15:27:56 +0100
Subject: [PATCH] feat: prolog hello world
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
---
 prolog/hello-world/.exercism/config.json   | 26 +++++++
 prolog/hello-world/.exercism/metadata.json |  1 +
 prolog/hello-world/HELP.md                 | 84 ++++++++++++++++++++++
 prolog/hello-world/README.md               | 39 ++++++++++
 prolog/hello-world/hello_world.pl          |  1 +
 prolog/hello-world/hello_world_tests.plt   | 17 +++++
 6 files changed, 168 insertions(+)
 create mode 100644 prolog/hello-world/.exercism/config.json
 create mode 100644 prolog/hello-world/.exercism/metadata.json
 create mode 100644 prolog/hello-world/HELP.md
 create mode 100644 prolog/hello-world/README.md
 create mode 100644 prolog/hello-world/hello_world.pl
 create mode 100644 prolog/hello-world/hello_world_tests.plt

diff --git a/prolog/hello-world/.exercism/config.json b/prolog/hello-world/.exercism/config.json
new file mode 100644
index 0000000..5a5f543
--- /dev/null
+++ b/prolog/hello-world/.exercism/config.json
@@ -0,0 +1,26 @@
+{
+  "authors": [
+    "parkerl"
+  ],
+  "contributors": [
+    "Average-user",
+    "heneryville",
+    "jackhughesweb",
+    "jesperp",
+    "kytrinyx"
+  ],
+  "files": {
+    "solution": [
+      "hello_world.pl"
+    ],
+    "test": [
+      "hello_world_tests.plt"
+    ],
+    "example": [
+      ".meta/hello_world.example.pl"
+    ]
+  },
+  "blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
+  "source": "This is an exercise to introduce users to using Exercism",
+  "source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
+}
diff --git a/prolog/hello-world/.exercism/metadata.json b/prolog/hello-world/.exercism/metadata.json
new file mode 100644
index 0000000..95eb907
--- /dev/null
+++ b/prolog/hello-world/.exercism/metadata.json
@@ -0,0 +1 @@
+{"track":"prolog","exercise":"hello-world","id":"058eb3a37659491d8c9d4ff6a351d8b2","url":"https://exercism.org/tracks/prolog/exercises/hello-world","handle":"cafkafk","is_requester":true,"auto_approve":false}
\ No newline at end of file
diff --git a/prolog/hello-world/HELP.md b/prolog/hello-world/HELP.md
new file mode 100644
index 0000000..c707441
--- /dev/null
+++ b/prolog/hello-world/HELP.md
@@ -0,0 +1,84 @@
+# Help
+
+## Running the tests
+
+## Command line
+
+The following command can be used to run the tests from the command line:
+
+```bash
+swipl -f <exercise>.pl -s <exercise>_tests.plt -g run_tests,halt -t 'halt(1)'
+```
+
+Replace `<exercise>` with the name of the exercise you are implementing.
+
+## Interactive
+
+To run prolog interactively first run:
+
+```bash
+swipl
+```
+
+After the prolog console starts, load your implementation and run the tests
+with:
+
+```
+?- ["<exercise>.pl"].
+?- ["<exercise>_tests.plt"].
+?- run_tests.
+```
+
+Replace `<exercise>` with the name of the exercise you are implementing.
+
+### Reloading changes
+
+Once the above files are loaded, you can apply any changes you've made
+by running:
+
+```
+?- make.
+```
+
+## Skipped tests
+
+When you first begin an exercise, only the first test will run. The rest have
+been skipped by adding `condition(pending)` to the `test` goal. Once the first
+test passes, un-skip the next test by changing `pending` in `condition(pending)`
+to `true`. Repeat for each test until they are all running and passing.
+
+### Command line
+
+Add the `-- --all` argument to the end of the command to also run any pending tests:
+
+```bash
+swipl -f <exercise>.pl -s <exercise>_tests.plt -g run_tests,halt -t 'halt(1)' -- --all
+```
+
+## Submitting your solution
+
+You can submit your solution using the `exercism submit hello_world.pl` command.
+This command will upload your solution to the Exercism website and print the solution page's URL.
+
+It's possible to submit an incomplete solution which allows you to:
+
+- See how others have completed the exercise
+- Request help from a mentor
+
+## Need to get help?
+
+If you'd like help solving the exercise, check the following pages:
+
+- The [Prolog track's documentation](https://exercism.org/docs/tracks/prolog)
+- The [Prolog track's programming category on the forum](https://forum.exercism.org/c/programming/prolog)
+- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
+- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)
+
+Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.
+
+To get help if you're having trouble, you can use one of the following resources:
+
+- [SWI Prolog Documentation](http://www.swi-prolog.org)
+- [Tutorials and Resources](http://www.swi-prolog.org/Links.html)
+- [/r/prolog](https://www.reddit.com/r/prolog) is the Prolog subreddit.
+- [StackOverflow](http://stackoverflow.com/questions/tagged/prolog) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions.
\ No newline at end of file
diff --git a/prolog/hello-world/README.md b/prolog/hello-world/README.md
new file mode 100644
index 0000000..0fc7518
--- /dev/null
+++ b/prolog/hello-world/README.md
@@ -0,0 +1,39 @@
+# Hello World
+
+Welcome to Hello World on Exercism's Prolog Track.
+If you need help running the tests or submitting your code, check out `HELP.md`.
+
+## Instructions
+
+The classical introductory exercise.
+Just say "Hello, World!".
+
+["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.
+
+The objectives are simple:
+
+- Modify the provided code so that it produces the string "Hello, World!".
+- Run the test suite and make sure that it succeeds.
+- Submit your solution and check it at the website.
+
+If everything goes well, you will be ready to fetch your first real exercise.
+
+[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
+
+## Source
+
+### Created by
+
+- @parkerl
+
+### Contributed to by
+
+- @Average-user
+- @heneryville
+- @jackhughesweb
+- @jesperp
+- @kytrinyx
+
+### Based on
+
+This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
\ No newline at end of file
diff --git a/prolog/hello-world/hello_world.pl b/prolog/hello-world/hello_world.pl
new file mode 100644
index 0000000..75fb5c8
--- /dev/null
+++ b/prolog/hello-world/hello_world.pl
@@ -0,0 +1 @@
+hello_world('Hello, World!').
diff --git a/prolog/hello-world/hello_world_tests.plt b/prolog/hello-world/hello_world_tests.plt
new file mode 100644
index 0000000..c91a2d5
--- /dev/null
+++ b/prolog/hello-world/hello_world_tests.plt
@@ -0,0 +1,17 @@
+% Please visit https://exercism.org/docs/tracks/prolog/installation
+% for instructions on setting up prolog.
+% Visit https://exercism.org/docs/tracks/prolog/tests
+% for help running the tests for prolog exercises.
+
+pending :-
+    current_prolog_flag(argv, ['--all'|_]).
+pending :-
+    write('\nA TEST IS PENDING!\n'),
+    fail.
+
+:- begin_tests(hello_world).
+
+    test(hello_world, condition(true)) :-
+        hello_world('Hello, World!').
+
+:- end_tests(hello_world).