Compare commits
5 Commits
ed15159576
...
dc62cd9970
Author | SHA1 | Date | |
---|---|---|---|
dc62cd9970 | |||
00fb5eb9bc | |||
4089851fc8 | |||
7097e19d40 | |||
16b92f4c34 |
41
README.md
41
README.md
@ -1,12 +1,41 @@
|
|||||||
# Lua Exercises
|
# Lua Exercises
|
||||||
|
|
||||||
This repo contains some Lua exercises along with automated tests for
|
This repo contains some Lua exercises along with automated tests for
|
||||||
their solutions. Each file contains a description of the problem and
|
solutions. Each file contains a description of the problem and an
|
||||||
an area for your solution as well as the tests. Feel free to define
|
area for a solution as well as the tests.
|
||||||
as many functions and constants as you need in the solution area, but
|
|
||||||
do not modify the tests. It's recommended that you roughly stick to
|
## Set Up
|
||||||
the defined order of the exercises, but feel free to deviate if you
|
|
||||||
wish.
|
To get started, create a fork of this repo on your own account (with
|
||||||
|
the "Fork" button in the top-left of the Gitea page"), then clone it,
|
||||||
|
passing the `--recursive` flag. If you already cloned it without
|
||||||
|
passing `--recursive`, you can run `git submodule update --init` to
|
||||||
|
fix it.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone --recursive git@git.wip.sh:<your-username>/lua-exercises.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you have a local clone of the repo, `cd` into the directory and
|
||||||
|
run `nix develop .` to activate the development environment. The
|
||||||
|
first time you do this it might take a little while but it should be
|
||||||
|
fairly fast afterwards.
|
||||||
|
|
||||||
|
## Doing the Exercises
|
||||||
|
|
||||||
|
It's recommended that you roughly stick to the defined order of the
|
||||||
|
exercises, but feel free to deviate if you wish. Some of the
|
||||||
|
exercises are relatively easy, whereas some of them (especially the
|
||||||
|
last few) are quite challenging; do not be disheartened if solving a
|
||||||
|
particular exercise takes you a long time, and feel free to ask for
|
||||||
|
help in the Discord server if you feel you are stuck.
|
||||||
|
|
||||||
|
You can define as many functions and constants as you need in the
|
||||||
|
solution area. You might find it useful to temporarily comment out
|
||||||
|
some of the tests to work through the cases one by one (especially on
|
||||||
|
the more complex exercises), but do not modify the test code other
|
||||||
|
than this, and make sure all the cases are un-commented again before
|
||||||
|
considering the exercise solved.
|
||||||
|
|
||||||
To run the tests and check your solution for a given exercise, simply
|
To run the tests and check your solution for a given exercise, simply
|
||||||
run `lua <the-file>`. For example, if you were working on the
|
run `lua <the-file>`. For example, if you were working on the
|
||||||
|
40
flake.lock
generated
Normal file
40
flake.lock
generated
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-schemas": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1697467827,
|
||||||
|
"narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=",
|
||||||
|
"rev": "764932025c817d4e500a8d2a4d8c565563923d29",
|
||||||
|
"revCount": 29,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1702346276,
|
||||||
|
"narHash": "sha256-eAQgwIWApFQ40ipeOjVSoK4TEHVd6nbSd9fApiHIw5A=",
|
||||||
|
"rev": "cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7",
|
||||||
|
"revCount": 553141,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.553141%2Brev-cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7/018c652c-2ff2-777b-bade-dae9c2abe1e1/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-schemas": "flake-schemas",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
28
flake.nix
Normal file
28
flake.nix
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
description = "Environment for Lua programming exercises";
|
||||||
|
inputs = {
|
||||||
|
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
|
||||||
|
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, flake-schemas, nixpkgs }:
|
||||||
|
let
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
schemas = flake-schemas.schemas;
|
||||||
|
devShells = forEachSupportedSystem ({ pkgs }: {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
name = "lua-exercises";
|
||||||
|
packages = with pkgs; [ git lua ];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user