├── .appends └── .github │ └── labels.yml ├── .github ├── CODEOWNERS ├── dependabot.yml ├── labels.yml └── workflows │ ├── configlet.yml │ ├── no-important-files-changed.yml │ ├── pause-community-contributions.yml │ ├── ping-cross-track-maintainers-team.yml │ ├── sync-labels.yml │ └── test.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── Makefile ├── README.md ├── bin ├── fetch-configlet └── verify-exercises ├── config.json ├── docs ├── ABOUT.md ├── INSTALLATION.md ├── LEARNING.md ├── RESOURCES.md ├── SNIPPET.txt ├── TESTS.md └── config.json ├── exercises ├── practice │ ├── accumulate │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── accumulate.app.src │ │ │ └── accumulate.lfe │ │ └── test │ │ │ └── accumulate-tests.lfe │ ├── acronym │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── acronym.app.src │ │ │ └── acronym.lfe │ │ └── test │ │ │ └── acronym-tests.lfe │ ├── allergies │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── allergies.app.src │ │ │ └── allergies.lfe │ │ └── test │ │ │ └── allergies-tests.lfe │ ├── anagram │ │ ├── .docs │ │ │ ├── instructions.append.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── anagram.app.src │ │ │ └── anagram.lfe │ │ └── test │ │ │ └── anagram-tests.lfe │ ├── armstrong-numbers │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── armstrong-numbers.app.src │ │ │ └── armstrong-numbers.lfe │ │ └── test │ │ │ └── armstrong-numbers-tests.lfe │ ├── atbash-cipher │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── atbash-cipher.app.src │ │ │ └── atbash-cipher.lfe │ │ └── test │ │ │ └── atbash-cipher-tests.lfe │ ├── bank-account │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ └── example.lfe │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── bank-account.app.src │ │ │ └── bank-account.lfe │ │ └── test │ │ │ └── bank-account-tests.lfe │ ├── beer-song │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── beer-song.app.src │ │ │ └── beer-song.lfe │ │ └── test │ │ │ └── beer-song-tests.lfe │ ├── binary-search │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── binary-search.app.src │ │ │ └── binary-search.lfe │ │ └── test │ │ │ └── binary-search-tests.lfe │ ├── binary │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── binary-string.app.src │ │ │ └── binary-string.lfe │ │ └── test │ │ │ └── binary-string-tests.lfe │ ├── bob │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── description.md │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── bob.app.src │ │ │ └── bob.lfe │ │ └── test │ │ │ └── bob-tests.lfe │ ├── circular-buffer │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── circular-buffer.app.src │ │ │ └── circular-buffer.lfe │ │ └── test │ │ │ └── circular-buffer-tests.lfe │ ├── clock │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── clock.app.src │ │ │ └── clock.lfe │ │ └── test │ │ │ └── clock-tests.lfe │ ├── collatz-conjecture │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── collatz-conjecture.app.src │ │ │ └── collatz-conjecture.lfe │ │ └── test │ │ │ └── collatz-conjecture-tests.lfe │ ├── darts │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── darts.app.src │ │ │ └── darts.lfe │ │ └── test │ │ │ └── darts-tests.lfe │ ├── difference-of-squares │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── difference-of-squares.app.src │ │ │ └── difference-of-squares.lfe │ │ └── test │ │ │ └── difference-of-squares-tests.lfe │ ├── dnd-character │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── dnd-character.app.src │ │ │ └── dnd-character.lfe │ │ └── test │ │ │ └── dnd-character-tests.lfe │ ├── eliuds-eggs │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── eliuds-eggs.app.src │ │ │ └── eliuds-eggs.lfe │ │ └── test │ │ │ └── eliuds-eggs-tests.lfe │ ├── etl │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── etl.app.src │ │ │ └── etl.lfe │ │ └── test │ │ │ └── etl-tests.lfe │ ├── gigasecond │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── gigasecond.app.src │ │ │ └── gigasecond.lfe │ │ └── test │ │ │ └── gigasecond-tests.lfe │ ├── grade-school │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── grade-school.app.src │ │ │ └── grade-school.lfe │ │ └── test │ │ │ └── grade-school-tests.lfe │ ├── grains │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── grains.app.src │ │ │ └── grains.lfe │ │ └── test │ │ │ └── grains-tests.lfe │ ├── hamming │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── hamming.app.src │ │ │ └── hamming.lfe │ │ └── test │ │ │ └── hamming-tests.lfe │ ├── hello-world │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── hello-world.app.src │ │ │ └── hello-world.lfe │ │ └── test │ │ │ └── hello-world-tests.lfe │ ├── high-scores │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── high-scores.app.src │ │ │ └── high-scores.lfe │ │ └── test │ │ │ └── high-scores-tests.lfe │ ├── isogram │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── isogram.app.src │ │ │ └── isogram.lfe │ │ └── test │ │ │ └── isogram-tests.lfe │ ├── kindergarten-garden │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── kindergarten-garden.app.src │ │ │ └── kindergarten-garden.lfe │ │ └── test │ │ │ └── kindergarten-garden-tests.lfe │ ├── knapsack │ │ ├── .docs │ │ │ ├── instructions.append.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── include │ │ │ └── item.lfe │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── knapsack.app.src │ │ │ └── knapsack.lfe │ │ └── test │ │ │ └── knapsack-tests.lfe │ ├── largest-series-product │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── largest-series-product.app.src │ │ │ └── largest-series-product.lfe │ │ └── test │ │ │ └── largest-series-product-tests.lfe │ ├── leap │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── leap.app.src │ │ │ └── leap.lfe │ │ └── test │ │ │ └── leap-tests.lfe │ ├── list-ops │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── list-ops.app.src │ │ │ └── list-ops.lfe │ │ └── test │ │ │ └── list-ops-tests.lfe │ ├── luhn │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── luhn.app.src │ │ │ └── luhn.lfe │ │ └── test │ │ │ └── luhn-tests.lfe │ ├── matching-brackets │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── matching-brackets.app.src │ │ │ └── matching-brackets.lfe │ │ └── test │ │ │ └── matching-brackets-tests.lfe │ ├── meetup │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── meetup.app.src │ │ │ └── meetup.lfe │ │ └── test │ │ │ └── meetup-tests.lfe │ ├── nucleotide-count │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── nucleotide-count.app.src │ │ │ └── nucleotide-count.lfe │ │ └── test │ │ │ └── nucleotide-count-tests.lfe │ ├── pangram │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── pangram.app.src │ │ │ └── pangram.lfe │ │ └── test │ │ │ └── pangram-tests.lfe │ ├── parallel-letter-frequency │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ └── example.lfe │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── parallel-letter-frequency.app.src │ │ │ └── parallel-letter-frequency.lfe │ │ └── test │ │ │ └── parallel-letter-frequency-tests.lfe │ ├── pascals-triangle │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── pascals-triangle.app.src │ │ │ └── pascals-triangle.lfe │ │ └── test │ │ │ └── pascals-triangle-tests.lfe │ ├── perfect-numbers │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── perfect-numbers.app.src │ │ │ └── perfect-numbers.lfe │ │ └── test │ │ │ └── perfect-numbers-tests.lfe │ ├── phone-number │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── phone-number.app.src │ │ │ └── phone-number.lfe │ │ └── test │ │ │ └── phone-number-tests.lfe │ ├── protein-translation │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── protein-translation.app.src │ │ │ └── protein-translation.lfe │ │ └── test │ │ │ └── protein-translation-tests.lfe │ ├── queen-attack │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── queen-attack.app.src │ │ │ └── queen-attack.lfe │ │ └── test │ │ │ └── queen-attack-tests.lfe │ ├── raindrops │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── raindrops.app.src │ │ │ └── raindrops.lfe │ │ └── test │ │ │ └── raindrops-tests.lfe │ ├── resistor-color-duo │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── resistor-color-duo.app.src │ │ │ └── resistor-color-duo.lfe │ │ └── test │ │ │ └── resistor-color-duo-tests.lfe │ ├── resistor-color │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── resistor-color.app.src │ │ │ └── resistor-color.lfe │ │ └── test │ │ │ └── resistor-color-tests.lfe │ ├── reverse-string │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── reverse-string.app.src │ │ │ └── reverse-string.lfe │ │ └── test │ │ │ └── reverse-string-tests.lfe │ ├── rna-transcription │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── rna-transcription.app.src │ │ │ └── rna-transcription.lfe │ │ └── test │ │ │ └── rna-transcription-tests.lfe │ ├── robot-simulator │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── robot-simulator.app.src │ │ │ └── robot-simulator.lfe │ │ └── test │ │ │ └── robot-simulator-tests.lfe │ ├── roman-numerals │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── roman-numerals.app.src │ │ │ └── roman-numerals.lfe │ │ └── test │ │ │ └── roman-numerals-tests.lfe │ ├── rotational-cipher │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── rotational-cipher.app.src │ │ │ └── rotational-cipher.lfe │ │ └── test │ │ │ └── rotational-cipher-tests.lfe │ ├── scrabble-score │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── scrabble-score.app.src │ │ │ └── scrabble-score.lfe │ │ └── test │ │ │ └── scrabble-score-tests.lfe │ ├── secret-handshake │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── secret-handshake.app.src │ │ │ └── secret-handshake.lfe │ │ └── test │ │ │ └── secret-handshake-tests.lfe │ ├── series │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── series.app.src │ │ │ └── series.lfe │ │ └── test │ │ │ └── series-tests.lfe │ ├── sieve │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── sieve.app.src │ │ │ └── sieve.lfe │ │ └── test │ │ │ └── sieve-tests.lfe │ ├── space-age │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── space-age.app.src │ │ │ └── space-age.lfe │ │ └── test │ │ │ └── space-age-tests.lfe │ ├── square-root │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── square-root.app.src │ │ │ └── square-root.lfe │ │ └── test │ │ │ └── square-root-tests.lfe │ ├── strain │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── strain.app.src │ │ │ └── strain.lfe │ │ └── test │ │ │ └── strain-tests.lfe │ ├── sum-of-multiples │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── sum-of-multiples.app.src │ │ │ └── sum-of-multiples.lfe │ │ └── test │ │ │ └── sum-of-multiples-tests.lfe │ ├── triangle │ │ ├── .docs │ │ │ ├── instructions.append.md │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── triangle.app.src │ │ │ └── triangle.lfe │ │ └── test │ │ │ └── triangle-tests.lfe │ ├── trinary │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── trinary.app.src │ │ │ └── trinary.lfe │ │ └── test │ │ │ └── trinary-tests.lfe │ ├── two-fer │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── two-fer.app.src │ │ │ └── two-fer.lfe │ │ └── test │ │ │ └── two-fer-tests.lfe │ ├── word-count │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── config.json │ │ │ ├── example.lfe │ │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ │ ├── word-count.app.src │ │ │ └── word-count.lfe │ │ └── test │ │ │ └── word-count-tests.lfe │ └── yacht │ │ ├── .docs │ │ ├── instructions.md │ │ └── introduction.md │ │ ├── .meta │ │ ├── config.json │ │ ├── example.lfe │ │ └── tests.toml │ │ ├── Makefile │ │ ├── rebar.config │ │ ├── rebar.lock │ │ ├── src │ │ ├── yacht.app.src │ │ └── yacht.lfe │ │ └── test │ │ └── yacht-tests.lfe └── shared │ └── .docs │ ├── help.md │ └── tests.md ├── rebar.config └── rebar.lock /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners 2 | .github/CODEOWNERS @exercism/maintainers-admin 3 | 4 | # Changes to `fetch-configlet` should be made in the `exercism/configlet` repo 5 | bin/fetch-configlet @exercism/maintainers-admin 6 | 7 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | 5 | # Keep dependencies for GitHub Actions up-to-date 6 | - package-ecosystem: 'github-actions' 7 | directory: '/' 8 | schedule: 9 | interval: 'monthly' 10 | -------------------------------------------------------------------------------- /.github/workflows/configlet.yml: -------------------------------------------------------------------------------- 1 | name: Configlet 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | configlet: 15 | uses: exercism/github-actions/.github/workflows/configlet.yml@main 16 | -------------------------------------------------------------------------------- /.github/workflows/ping-cross-track-maintainers-team.yml: -------------------------------------------------------------------------------- 1 | name: Ping cross-track maintainers team 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | 8 | permissions: 9 | pull-requests: write 10 | 11 | jobs: 12 | ping: 13 | if: github.repository_owner == 'exercism' # Stops this job from running on forks 14 | uses: exercism/github-actions/.github/workflows/ping-cross-track-maintainers-team.yml@main 15 | secrets: 16 | github_membership_token: ${{ secrets.COMMUNITY_CONTRIBUTIONS_WORKFLOW_TOKEN }} 17 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yml: -------------------------------------------------------------------------------- 1 | name: Tools 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - .github/labels.yml 9 | - .github/workflows/sync-labels.yml 10 | workflow_dispatch: 11 | schedule: 12 | - cron: 0 0 1 * * # First day of each month 13 | 14 | permissions: 15 | issues: write 16 | 17 | jobs: 18 | sync-labels: 19 | uses: exercism/github-actions/.github/workflows/labels.yml@main 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## -*- conf -*- 2 | .rebar3 3 | _build/ 4 | ebin/ 5 | erl_crash.dump 6 | rebar3.crashdump 7 | 8 | tmp 9 | bin/configlet 10 | bin/configlet.exe 11 | CHECKLIST 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | testmods := $(basename $(notdir $(wildcard exercises/*/test/*.lfe))) 8 | 9 | ifeq ($(ERL),) 10 | $(error Can't find Erlang executable 'erl') 11 | else ifeq ($(REBAR3),) 12 | $(error Can't find rebar3) 13 | endif 14 | 15 | compile: ; $(REBAR3) compile 16 | 17 | clean: ; $(REBAR3) clean 18 | 19 | .PHONY: test 20 | test: ; $(REBAR3) eunit -m $(subst $(space),$(comma),$(testmods)) 21 | -------------------------------------------------------------------------------- /docs/LEARNING.md: -------------------------------------------------------------------------------- 1 | # Learning 2 | 3 | Exercism provides exercises and feedback but can be difficult to jump into for 4 | those learning LFE for the first time. These resources can help you get started: 5 | 6 | * [LFE Quick Start](http://lfe.gitbooks.io/quick-start/) 7 | * [LFE Tutorial](http://lfe.gitbooks.io/tutorial/) 8 | * [LFE Documentation](http://docs.lfe.io/) 9 | * [Casting SPELs in Lisp](http://lfe.gitbooks.io/casting-spels/) (LFE Edition) 10 | * [LFE Presentations](http://docs.lfe.io/current/presentations.html) 11 | 12 | See also: [Erlang recommended learning resources][3] 13 | 14 | [3]: /languages/erlang#learning 15 | -------------------------------------------------------------------------------- /docs/RESOURCES.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | - [LFE Documentation](http://docs.lfe.io/) 4 | -------------------------------------------------------------------------------- /docs/SNIPPET.txt: -------------------------------------------------------------------------------- 1 | (defmodule leap 2 | (export (leap-year 1))) 3 | 4 | (defun leap-year 5 | ([year] (when (=:= (rem year 400) 0)) 6 | 'true) 7 | ([year] (when (=:= (rem year 100) 0)) 8 | 'false) 9 | ([year] (when (=:= (rem year 4) 0)) 10 | 'true) 11 | ([_] 12 | 'false)) 13 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule accumulate 2 | (export (accumulate 2))) 3 | 4 | (defun accumulate 5 | ([f ()] ()) 6 | ([f (cons h t)] (cons (funcall f h) (accumulate f t)))) 7 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/src/accumulate.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'accumulate', 3 | [{description, "exercism.org - accumulate"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['accumulate']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/src/accumulate.lfe: -------------------------------------------------------------------------------- 1 | (defmodule accumulate 2 | (export (accumulate 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Convert a phrase to its acronym. 4 | 5 | Techies love their TLA (Three Letter Acronyms)! 6 | 7 | Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG). 8 | 9 | Punctuation is handled as follows: hyphens are word separators (like whitespace); all other punctuation can be removed from the input. 10 | 11 | For example: 12 | 13 | | Input | Output | 14 | | ------------------------- | ------ | 15 | | As Soon As Possible | ASAP | 16 | | Liquid-crystal display | LCD | 17 | | Thank George It's Friday! | TGIF | 18 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "kephas" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/acronym.lfe" 8 | ], 9 | "test": [ 10 | "test/acronym-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Convert a long phrase to its acronym.", 21 | "source": "Julien Vanier", 22 | "source_url": "https://github.com/monkbroc" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule acronym 2 | (export (abbreviate 1))) 3 | 4 | (defun upper (char) 5 | (string:to_upper char)) 6 | 7 | (defun upper? (char) 8 | (!= 'nomatch (re:run (list char) "\\p{Lu}"))) 9 | 10 | (defun break? 11 | ((#\ ) 'true) 12 | ((#\-) 'true) 13 | ((_) 'false)) 14 | 15 | (defun abbreviate 16 | (((cons c1 (cons c2 cs))) 17 | (cond 18 | ((and (upper? c1) (upper? c2)) 19 | (abbreviate (cons c1 cs))) 20 | ((upper? c1) 21 | (cons c1 (abbreviate (cons c2 cs)))) 22 | ((break? c1) 23 | (abbreviate (cons (upper c2) cs))) 24 | ('true 25 | (abbreviate (cons c2 cs))))) 26 | ((_) ())) 27 | -------------------------------------------------------------------------------- /exercises/practice/acronym/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/acronym/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/acronym/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/acronym/src/acronym.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'acronym', 3 | [{description, "exercism.org - acronym"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['acronym']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/acronym/src/acronym.lfe: -------------------------------------------------------------------------------- 1 | (defmodule acronym 2 | (export (abbreviate 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/allergies/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/allergies/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/allergies/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/allergies/src/allergies.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'allergies', 3 | [{description, "exercism.org - allergies"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['allergies']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/allergies/src/allergies.lfe: -------------------------------------------------------------------------------- 1 | (defmodule allergies 2 | (export (allergies 1) 3 | (allergic-to? 2))) 4 | 5 | ; Please implement the exported function(s). 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/anagram/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | # Instructions Append 2 | 3 | You must return the anagrams in the same order as they are listed in the candidate words. 4 | -------------------------------------------------------------------------------- /exercises/practice/anagram/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule anagram 2 | (export (find 2))) 3 | 4 | (defun find (word candidates) 5 | (let ((normed-word (normalize word))) 6 | (lists:filter 7 | (lambda (candidate) (anagram? normed-word (normalize candidate))) 8 | candidates))) 9 | 10 | (defun anagram? 11 | ([`#(,word-lowered ,word-sorted) `#(,candidate-lowered ,candidate-sorted)] 12 | (when (andalso (=/= word-lowered candidate-lowered) 13 | (=:= word-sorted candidate-sorted))) 14 | 'true) 15 | ([_ _] 16 | 'false)) 17 | 18 | (defun normalize (str) 19 | (let ((lowered (string:to_lower str))) 20 | `#(,lowered ,(lists:sort lowered)))) 21 | -------------------------------------------------------------------------------- /exercises/practice/anagram/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/anagram/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/anagram/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/anagram/src/anagram.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'anagram', 3 | [{description, "exercism.org - anagram"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['anagram']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/anagram/src/anagram.lfe: -------------------------------------------------------------------------------- 1 | (defmodule anagram 2 | (export (find 2))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/armstrong-numbers.lfe" 8 | ], 9 | "test": [ 10 | "test/armstrong-numbers-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Determine if a number is an Armstrong number.", 21 | "source": "Wikipedia", 22 | "source_url": "https://en.wikipedia.org/wiki/Narcissistic_number" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/src/armstrong-numbers.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'armstrong-numbers', 3 | [{description, "exercism.org - armstrong numbers"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['armstrong-numbers']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/src/armstrong-numbers.lfe: -------------------------------------------------------------------------------- 1 | (defmodule armstrong-numbers 2 | (export (armstrong-number? 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "yurrriq" 4 | ], 5 | "contributors": [ 6 | "tmcgilchrist" 7 | ], 8 | "files": { 9 | "solution": [ 10 | "src/atbash-cipher.lfe" 11 | ], 12 | "test": [ 13 | "test/atbash-cipher-tests.lfe" 14 | ], 15 | "example": [ 16 | ".meta/example.lfe" 17 | ], 18 | "invalidator": [ 19 | "rebar.config", 20 | "rebar.lock" 21 | ] 22 | }, 23 | "blurb": "Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.", 24 | "source": "Wikipedia", 25 | "source_url": "https://en.wikipedia.org/wiki/Atbash" 26 | } 27 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/src/atbash-cipher.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'atbash-cipher', 3 | [{description, "exercism.org - atbash cipher"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['atbash-cipher']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/src/atbash-cipher.lfe: -------------------------------------------------------------------------------- 1 | (defmodule atbash-cipher 2 | (export (encode 1) 3 | (decode 1))) 4 | 5 | ; Please implement the exported function(s). 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/bank-account/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "yurrriq" 4 | ], 5 | "contributors": [ 6 | "tmcgilchrist" 7 | ], 8 | "files": { 9 | "solution": [ 10 | "src/bank-account.lfe" 11 | ], 12 | "test": [ 13 | "test/bank-account-tests.lfe" 14 | ], 15 | "example": [ 16 | ".meta/example.lfe" 17 | ], 18 | "invalidator": [ 19 | "rebar.config", 20 | "rebar.lock" 21 | ] 22 | }, 23 | "blurb": "Simulate a bank account supporting opening/closing, withdraws, and deposits of money. Watch out for concurrent transactions!" 24 | } 25 | -------------------------------------------------------------------------------- /exercises/practice/bank-account/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/bank-account/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/bank-account/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/bank-account/src/bank-account.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'bank-account', 3 | [{description, "exercism.org - bank account"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['bank-account']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/bank-account/src/bank-account.lfe: -------------------------------------------------------------------------------- 1 | (defmodule bank-account 2 | (export (balance 1) 3 | (charge 2) 4 | (close 1) 5 | (create 0) 6 | (deposit 2) 7 | (withdraw 2))) 8 | 9 | ; Please implement the exported function(s). 10 | 11 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/src/beer-song.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'beer-song', 3 | [{description, "exercism.org - beer song"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['beer-song']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/src/beer-song.lfe: -------------------------------------------------------------------------------- 1 | (defmodule beer-song 2 | (export (verse 1) 3 | (sing 2))) 4 | 5 | ; Please implement the exported function(s). 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/binary-search.lfe" 8 | ], 9 | "test": [ 10 | "test/binary-search-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Implement a binary search algorithm.", 21 | "source": "Wikipedia", 22 | "source_url": "https://en.wikipedia.org/wiki/Binary_search_algorithm" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/src/binary-search.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'binary-search', 3 | [{description, "exercism.org - binary search"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['binary-search']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/src/binary-search.lfe: -------------------------------------------------------------------------------- 1 | (defmodule binary-search 2 | (export (find 2))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/binary/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule binary-string 2 | (export (to-decimal 1))) 3 | 4 | (defun to-decimal (string) 5 | (list_to_integer string 2)) 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/binary/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/binary/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/binary/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/binary/src/binary-string.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'binary-string', 3 | [{description, "exercism.org - binary string"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['binary-string']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/binary/src/binary-string.lfe: -------------------------------------------------------------------------------- 1 | (defmodule binary-string 2 | (export (to-decimal 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/bob/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Bob is a [lackadaisical][] teenager. 4 | He likes to think that he's very cool. 5 | And he definitely doesn't get excited about things. 6 | That wouldn't be cool. 7 | 8 | When people talk to him, his responses are pretty limited. 9 | 10 | [lackadaisical]: https://www.collinsdictionary.com/dictionary/english/lackadaisical 11 | -------------------------------------------------------------------------------- /exercises/practice/bob/.meta/description.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Bob is a lackadaisical teenager. In conversation, his responses are very limited. 4 | 5 | Bob answers 'Sure.' if you ask him a question. 6 | 7 | He answers 'Whoa, chill out!' if you yell at him. 8 | 9 | He says 'Fine. Be that way!' if you address him without actually saying 10 | anything. 11 | 12 | He answers 'Whatever.' to anything else. 13 | -------------------------------------------------------------------------------- /exercises/practice/bob/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/bob/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/bob/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/bob/src/bob.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'bob', 3 | [{description, "exercism.org - bob"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['bob']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/bob/src/bob.lfe: -------------------------------------------------------------------------------- 1 | (defmodule bob 2 | (export (response-for 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/src/circular-buffer.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'circular-buffer', 3 | [{description, "exercism.org - circular buffer"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['circular-buffer']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/src/circular-buffer.lfe: -------------------------------------------------------------------------------- 1 | (defmodule circular-buffer 2 | (export (create 1) 3 | (read 1) 4 | (size 1) 5 | (write 2) 6 | (write-attempt 2))) 7 | 8 | ; Please implement the exported function(s). 9 | 10 | -------------------------------------------------------------------------------- /exercises/practice/clock/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Implement a clock that handles times without dates. 4 | 5 | You should be able to add and subtract minutes to it. 6 | 7 | Two clocks that represent the same time should be equal to each other. 8 | -------------------------------------------------------------------------------- /exercises/practice/clock/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "lehoff" 4 | ], 5 | "contributors": [ 6 | "tmcgilchrist", 7 | "yurrriq" 8 | ], 9 | "files": { 10 | "solution": [ 11 | "src/clock.lfe" 12 | ], 13 | "test": [ 14 | "test/clock-tests.lfe" 15 | ], 16 | "example": [ 17 | ".meta/example.lfe" 18 | ], 19 | "invalidator": [ 20 | "rebar.config", 21 | "rebar.lock" 22 | ] 23 | }, 24 | "blurb": "Implement a clock that handles times without dates.", 25 | "source": "Pairing session with Erin Drummond" 26 | } 27 | -------------------------------------------------------------------------------- /exercises/practice/clock/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/clock/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/clock/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/clock/src/clock.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'clock', 3 | [{description, "exercism.org - clock"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['clock']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/clock/src/clock.lfe: -------------------------------------------------------------------------------- 1 | (defmodule clock 2 | (export (create 2) 3 | (equal? 2) 4 | (minutes-add 2) 5 | (minutes-delete 2) 6 | (to-string 1))) 7 | 8 | ; Please implement the exported function(s). 9 | 10 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture. 4 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/collatz-conjecture.lfe" 8 | ], 9 | "test": [ 10 | "test/collatz-conjecture-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Calculate the number of steps to reach 1 using the Collatz conjecture.", 21 | "source": "Wikipedia", 22 | "source_url": "https://en.wikipedia.org/wiki/Collatz_conjecture" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule collatz-conjecture 2 | (export (steps 1))) 3 | 4 | (defun add1 (n) (+ n 1)) 5 | 6 | (defun zerop (n) (=:= (rem n 2))) 7 | 8 | (defun steps (start) 9 | (do-steps start 0)) 10 | 11 | (defun do-steps 12 | ((n _) (when (< n 1)) 13 | (error "Only positive integers are allowed")) 14 | ((1 acc) 15 | acc) 16 | ((n acc) (when (=:= (rem n 2) 0)) 17 | (do-steps (div n 2) (add1 acc))) 18 | ((n acc) 19 | (do-steps (add1 (* 3 n)) (add1 acc)))) 20 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/src/collatz-conjecture.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'collatz-conjecture', 3 | [{description, "exercism.org - collatz conjecture"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['collatz-conjecture']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/src/collatz-conjecture.lfe: -------------------------------------------------------------------------------- 1 | (defmodule collatz-conjecture 2 | (export (steps 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/darts/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/darts.lfe" 8 | ], 9 | "test": [ 10 | "test/darts-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Calculate the points scored in a single toss of a Darts game.", 21 | "source": "Inspired by an exercise created by a professor Della Paolera in Argentina" 22 | } 23 | -------------------------------------------------------------------------------- /exercises/practice/darts/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule darts 2 | (export (score 2))) 3 | 4 | (defun score (x y) 5 | (assign-score (math:sqrt (+ (* x x) 6 | (* y y))))) 7 | 8 | (defun assign-score 9 | ((dist) (when (=< dist 1)) 10) 10 | ((dist) (when (=< dist 5)) 5) 11 | ((dist) (when (=< dist 10)) 1) 12 | ((_) 0)) 13 | -------------------------------------------------------------------------------- /exercises/practice/darts/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/darts/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/darts/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/darts/src/darts.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'darts', 3 | [{description, "exercism.org - darts"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['darts']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/darts/src/darts.lfe: -------------------------------------------------------------------------------- 1 | (defmodule darts 2 | (export (score 2))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/src/difference-of-squares.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'difference-of-squares', 3 | [{description, "exercism.org - difference of squares"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['difference-of-squares']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/src/difference-of-squares.lfe: -------------------------------------------------------------------------------- 1 | (defmodule difference-of-squares 2 | (export (square-of-sum 1) 3 | (sum-of-squares 1) 4 | (difference-of-squares 1))) 5 | 6 | ; Please implement the exported function(s). 7 | 8 | -------------------------------------------------------------------------------- /exercises/practice/dnd-character/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/dnd-character.lfe" 8 | ], 9 | "test": [ 10 | "test/dnd-character-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Randomly generate Dungeons & Dragons characters.", 21 | "source": "Simon Shine, Erik Schierboom", 22 | "source_url": "https://github.com/exercism/problem-specifications/issues/616#issuecomment-437358945" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/dnd-character/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/dnd-character/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/dnd-character/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/dnd-character/src/dnd-character.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'dnd-character', 3 | [{description, "exercism.org - d&d character"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['dnd-character']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/dnd-character/src/dnd-character.lfe: -------------------------------------------------------------------------------- 1 | (defmodule dnd-character 2 | (export (new-character 0) 3 | (ability 0) 4 | (modifier 1) 5 | (get-strength 1) 6 | (get-dexterity 1) 7 | (get-constitution 1) 8 | (get-intelligence 1) 9 | (get-wisdom 1) 10 | (get-charisma 1) 11 | (get-hitpoints 1))) 12 | 13 | ; Please implement the exported function(s). 14 | 15 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to count the number of 1 bits in the binary representation of a number. 4 | 5 | ## Restrictions 6 | 7 | Keep your hands off that bit-count functionality provided by your standard library! 8 | Solve this one yourself using other basic tools instead. 9 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule eliuds-eggs 2 | (export (egg-count 1))) 3 | 4 | (defun egg-count (display-value) 5 | (do-count display-value 0)) 6 | 7 | (defun do-count 8 | ((0 steps) steps) 9 | ((number steps) (when (> number 0)) (do-count (bsr number 1) (+ steps (band number 1))))) 10 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/src/eliuds-eggs.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'eliuds-eggs', 3 | [{description, "exercism.org - eliud's eggs"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['eliuds-eggs']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/src/eliuds-eggs.lfe: -------------------------------------------------------------------------------- 1 | (defmodule eliuds-eggs 2 | (export (egg-count 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/test/eliuds-eggs-tests.lfe: -------------------------------------------------------------------------------- 1 | (defmodule eliuds-eggs-tests 2 | (behaviour ltest-unit) 3 | (export all)) 4 | 5 | (include-lib "ltest/include/ltest-macros.lfe") 6 | 7 | (deftest zero-eggs 8 | (is-equal (eliuds-eggs:egg-count 0) 0)) 9 | 10 | (deftest one-egg 11 | (is-equal (eliuds-eggs:egg-count 16) 1)) 12 | 13 | (deftest four-eggs 14 | (is-equal (eliuds-eggs:egg-count 89) 4)) 15 | 16 | (deftest thirteen-eggs 17 | (is-equal (eliuds-eggs:egg-count 2000000000) 13)) 18 | -------------------------------------------------------------------------------- /exercises/practice/etl/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule etl 2 | (export (transform 1))) 3 | 4 | (defun transform (old-value) 5 | (orddict:to_list 6 | (orddict:from_list 7 | (lists:flatten 8 | (invert old-value))))) 9 | 10 | (defun invert (pairs) 11 | (lists:foldl 12 | (match-lambda 13 | ([`#(,key ,values) a] 14 | (lists:foldl 15 | (lambda (value acc) 16 | (orddict:update 17 | (string:to_lower value) 18 | (lambda (old) 19 | (lists:flatten (++ `(,old) `(,key)))) 20 | key 21 | acc)) 22 | a 23 | values))) 24 | (orddict:new) 25 | pairs)) 26 | -------------------------------------------------------------------------------- /exercises/practice/etl/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/etl/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/etl/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/etl/src/etl.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'etl', 3 | [{description, "exercism.org - etl"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['etl']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/etl/src/etl.lfe: -------------------------------------------------------------------------------- 1 | (defmodule etl 2 | (export (transform 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to determine the date and time one gigasecond after a certain date. 4 | 5 | A gigasecond is one thousand million seconds. 6 | That is a one with nine zeros after it. 7 | 8 | If you were born on _January 24th, 2015 at 22:00 (10:00:00pm)_, then you would be a gigasecond old on _October 2nd, 2046 at 23:46:40 (11:46:40pm)_. 9 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule gigasecond 2 | (export (from 1))) 3 | 4 | (defun gigasecond () 1000000000) 5 | 6 | (defun from 7 | ([`#(,year ,month ,day)] 8 | (from `#(#(,year ,month ,day) #(0 0 0)))) 9 | ([datetime] 10 | (let ((seconds (calendar:datetime_to_gregorian_seconds datetime))) 11 | (calendar:gregorian_seconds_to_datetime (+ seconds (gigasecond)))))) 12 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/src/gigasecond.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'gigasecond', 3 | [{description, "exercism.org - gigasecond"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['gigasecond']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/src/gigasecond.lfe: -------------------------------------------------------------------------------- 1 | (defmodule gigasecond 2 | (export (from 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule grade-school 2 | (export (add 3) 3 | (get 2) 4 | (new 0) 5 | (sort 1))) 6 | 7 | (defun add (name grade school) 8 | (case (get grade school) 9 | (() (orddict:store grade `(,name) school)) 10 | (class (orddict:store grade (ordsets:add_element name class) school)))) 11 | 12 | (defun get (grade students) 13 | (case (orddict:find grade students) 14 | (`#(ok ,class) class) 15 | (_ ()))) 16 | 17 | (defun new () ()) 18 | 19 | (defun sort (school) school) 20 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/src/grade-school.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'grade-school', 3 | [{description, "exercism.org - grade school"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['grade-school']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/src/grade-school.lfe: -------------------------------------------------------------------------------- 1 | (defmodule grade-school 2 | (export (add 3) 3 | (get 2) 4 | (new 0) 5 | (sort 1))) 6 | 7 | ; Please implement the exported function(s). 8 | 9 | -------------------------------------------------------------------------------- /exercises/practice/grains/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Calculate the number of grains of wheat on a chessboard. 4 | 5 | A chessboard has 64 squares. 6 | Square 1 has one grain, square 2 has two grains, square 3 has four grains, and so on, doubling each time. 7 | 8 | Write code that calculates: 9 | 10 | - the number of grains on a given square 11 | - the total number of grains on the chessboard 12 | -------------------------------------------------------------------------------- /exercises/practice/grains/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | There once was a wise servant who saved the life of a prince. 4 | The king promised to pay whatever the servant could dream up. 5 | Knowing that the king loved chess, the servant told the king he would like to have grains of wheat. 6 | One grain on the first square of a chessboard, with the number of grains doubling on each successive square. 7 | -------------------------------------------------------------------------------- /exercises/practice/grains/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule grains 2 | (export (square 1) 3 | (total 0))) 4 | 5 | (defun 1- (n) (- n 1)) 6 | 7 | (defun 2^ (x) (trunc (math:pow 2 x))) 8 | 9 | (defun square (n) (trunc (2^ (1- n)))) 10 | 11 | (defun total () (1- (square 65))) 12 | 13 | ;;; Naive, recursive approach 14 | ;; 15 | ;; (defun square (n) (square n 1)) 16 | ;; 17 | ;; (defun square 18 | ;; ([1 acc] acc) 19 | ;; ([n acc] (square (- n 1) (* acc 2)))) 20 | ;; 21 | ;; (defun total () 22 | ;; (lists:foldl 23 | ;; (lambda (x acc) 24 | ;; (+ (square x) acc)) 25 | ;; 0 26 | ;; (lists:seq 1 64))) 27 | -------------------------------------------------------------------------------- /exercises/practice/grains/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/grains/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/grains/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/grains/src/grains.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'grains', 3 | [{description, "exercism.org - grains"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['grains']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/grains/src/grains.lfe: -------------------------------------------------------------------------------- 1 | (defmodule grains 2 | (export (square 1) 3 | (total 0))) 4 | 5 | ; Please implement the exported function(s). 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Calculate the Hamming distance between two DNA strands. 4 | 5 | We read DNA using the letters C, A, G and T. 6 | Two strands might look like this: 7 | 8 | GAGCCTACTAACGGGAT 9 | CATCGTAATGACGGCCT 10 | ^ ^ ^ ^ ^ ^^ 11 | 12 | They have 7 differences, and therefore the Hamming distance is 7. 13 | 14 | ## Implementation notes 15 | 16 | The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work. 17 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "yurrriq" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/hamming.lfe" 8 | ], 9 | "test": [ 10 | "test/hamming-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Calculate the Hamming distance between two DNA strands.", 21 | "source": "The Calculating Point Mutations problem at Rosalind", 22 | "source_url": "https://rosalind.info/problems/hamm/" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule hamming 2 | (export (distance 2))) 3 | 4 | (defun distance (strand1 strand2) 5 | (if (not (== (length strand1) (length strand2))) 6 | (error "strands must have the same length") 7 | (lists:sum 8 | (lists:zipwith 9 | (lambda (a b) (if (=:= a b) 0 1)) 10 | strand1 11 | strand2)))) 12 | -------------------------------------------------------------------------------- /exercises/practice/hamming/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/hamming/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/hamming/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/hamming/src/hamming.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, hamming, 3 | [{description, "exercism.org - hamming"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | [hamming]}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/hamming/src/hamming.lfe: -------------------------------------------------------------------------------- 1 | (defmodule hamming 2 | (export (distance 2))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | The classical introductory exercise. 4 | Just say "Hello, World!". 5 | 6 | ["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment. 7 | 8 | The objectives are simple: 9 | 10 | - Modify the provided code so that it produces the string "Hello, World!". 11 | - Run the test suite and make sure that it succeeds. 12 | - Submit your solution and check it at the website. 13 | 14 | If everything goes well, you will be ready to fetch your first real exercise. 15 | 16 | [hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program 17 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule hello-world 2 | (export (hello-world 0))) 3 | 4 | (defun hello-world () 5 | "Hello, World!") 6 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.meta/tests.toml: -------------------------------------------------------------------------------- 1 | # This is an auto-generated file. 2 | # 3 | # Regenerating this file via `configlet sync` will: 4 | # - Recreate every `description` key/value pair 5 | # - Recreate every `reimplements` key/value pair, where they exist in problem-specifications 6 | # - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) 7 | # - Preserve any other key/value pair 8 | # 9 | # As user-added comments (using the # character) will be removed when this file 10 | # is regenerated, comments can be added via a `comment` key. 11 | 12 | [af9ffe10-dc13-42d8-a742-e7bdafac449d] 13 | description = "Say Hi!" 14 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/src/hello-world.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'hello-world', 3 | [{description, "exercism.org - hello world"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['hello-world']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/src/hello-world.lfe: -------------------------------------------------------------------------------- 1 | (defmodule hello-world 2 | (export (hello-world 0))) 3 | 4 | (defun hello-world () 5 | "Goodbye, Mars!") 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/test/hello-world-tests.lfe: -------------------------------------------------------------------------------- 1 | (defmodule hello-world-tests 2 | (behaviour ltest-unit) 3 | (export all)) 4 | 5 | (include-lib "ltest/include/ltest-macros.lfe") 6 | 7 | (deftest hello-world 8 | (is-equal "Hello, World!" (hello-world:hello-world))) 9 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Manage a game player's High Score list. 4 | 5 | Your task is to build a high-score component of the classic Frogger game, one of the highest selling and most addictive games of all time, and a classic of the arcade era. 6 | Your task is to write methods that return the highest score from the list, the last added score and the three highest scores. 7 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/high-scores.lfe" 8 | ], 9 | "test": [ 10 | "test/high-scores-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Manage a player's High Score list.", 21 | "source": "Tribute to the eighties' arcade game Frogger" 22 | } 23 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule high-scores 2 | (export (latest 1) 3 | (personal-best 1) 4 | (personal-top-three 1))) 5 | 6 | (defun latest (scores) 7 | (car (lists:reverse scores))) 8 | 9 | (defun personal-best (scores) 10 | (lists:max scores)) 11 | 12 | (defun personal-top-three (scores) 13 | (lists:sublist (lists:sort (lambda (a b) (> a b)) scores) 3)) 14 | 15 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/src/high-scores.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'high-scores', 3 | [{description, "exercism.org - high scores"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['high-scores']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/src/high-scores.lfe: -------------------------------------------------------------------------------- 1 | (defmodule high-scores 2 | (export (latest 1) 3 | (personal-best 1) 4 | (personal-top-three 1))) 5 | 6 | ; Please implement the exported function(s). 7 | 8 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Determine if a word or phrase is an isogram. 4 | 5 | An isogram (also known as a "non-pattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times. 6 | 7 | Examples of isograms: 8 | 9 | - lumberjacks 10 | - background 11 | - downstream 12 | - six-year-old 13 | 14 | The word _isograms_, however, is not an isogram, because the s repeats. 15 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/isogram.lfe" 8 | ], 9 | "test": [ 10 | "test/isogram-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Determine if a word or phrase is an isogram.", 21 | "source": "Wikipedia", 22 | "source_url": "https://en.wikipedia.org/wiki/Isogram" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule isogram 2 | (export (isogram? 1))) 3 | 4 | (defun isogram? (phrase) 5 | (let* ((lowered (string:to_lower phrase)) 6 | (chars (re:replace lowered 7 | "[^a-z]" 8 | "" 9 | '(#(return list) global))) 10 | (uniques (lists:usort chars))) 11 | (=:= (length chars) (length uniques)))) 12 | 13 | -------------------------------------------------------------------------------- /exercises/practice/isogram/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/isogram/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/isogram/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/isogram/src/isogram.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'isogram', 3 | [{description, "exercism.org - isogram"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['isogram']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/isogram/src/isogram.lfe: -------------------------------------------------------------------------------- 1 | (defmodule isogram 2 | (export (isogram? 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | The kindergarten class is learning about growing plants. 4 | The teacher thought it would be a good idea to give the class seeds to plant and grow in the dirt. 5 | To this end, the children have put little cups along the window sills and planted one type of plant in each cup. 6 | The children got to pick their favorites from four available types of seeds: grass, clover, radishes, and violets. 7 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/src/kindergarten-garden.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'kindergarten-garden', 3 | [{description, "exercism.org - kindergarten garden"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['kindergarten-garden']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/src/kindergarten-garden.lfe: -------------------------------------------------------------------------------- 1 | (defmodule kindergarten-garden 2 | (export (plants 2))) 3 | 4 | ; Please implement the exported function(s). 5 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | The items are represented by [records](https://lfe.gitbooks.io/reference-guide/content/16.html), defined in `item.lfe`. 2 | Use `item-weight` to get the weight and `item-value` to get the value. 3 | 4 | ``` 5 | ;; Create an item with weight=5, value=50 6 | (set item (make-item weight 5 value 50)) 7 | 8 | ;; Get the weight. Returns 5. 9 | (item-weight item) 10 | 11 | ;; Get the value. Returns 50. 12 | (item-value item) 13 | ``` 14 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Lhakpa is a [Sherpa][sherpa] mountain guide and porter. 4 | After months of careful planning, the expedition Lhakpa works for is about to leave. 5 | She will be paid the value she carried to the base camp. 6 | 7 | In front of her are many items, each with a value and weight. 8 | Lhakpa would gladly take all of the items, but her knapsack can only hold so much weight. 9 | 10 | [sherpa]: https://en.wikipedia.org/wiki/Sherpa_people#Mountaineering 11 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/include/item.lfe: -------------------------------------------------------------------------------- 1 | ; This include file defines the item record used in the exercise. 2 | ; There shouldn't be any need to modify this file. 3 | 4 | (defrecord item weight value) 5 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/src/knapsack.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'knapsack', 3 | [{description, "exercism.org - knapsack"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['knapsack']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/src/knapsack.lfe: -------------------------------------------------------------------------------- 1 | (defmodule knapsack 2 | (export (maximum-value 2))) 3 | 4 | (include-lib "include/item.lfe") 5 | 6 | ; Please implement the exported function(s). 7 | 8 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You work for a government agency that has intercepted a series of encrypted communication signals from a group of bank robbers. 4 | The signals contain a long sequence of digits. 5 | Your team needs to use various digital signal processing techniques to analyze the signals and identify any patterns that may indicate the planning of a heist. 6 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/src/largest-series-product.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'largest-series-product', 3 | [{description, "exercism.org - largest series product"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['largest-series-product']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/src/largest-series-product.lfe: -------------------------------------------------------------------------------- 1 | (defmodule largest-series-product 2 | (export (from-string 2))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/leap/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to determine whether a given year is a leap year. 4 | -------------------------------------------------------------------------------- /exercises/practice/leap/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | A leap year (in the Gregorian calendar) occurs: 4 | 5 | - In every year that is evenly divisible by 4. 6 | - Unless the year is evenly divisible by 100, in which case it's only a leap year if the year is also evenly divisible by 400. 7 | 8 | Some examples: 9 | 10 | - 1997 was not a leap year as it's not divisible by 4. 11 | - 1900 was not a leap year as it's not divisible by 400. 12 | - 2000 was a leap year! 13 | 14 | ~~~~exercism/note 15 | For a delightful, four-minute explanation of the whole phenomenon of leap years, check out [this YouTube video](https://www.youtube.com/watch?v=xX96xng7sAE). 16 | ~~~~ 17 | -------------------------------------------------------------------------------- /exercises/practice/leap/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule leap 2 | (export (leap-year 1))) 3 | 4 | (defun leap-year 5 | ([year] (when (=:= (rem year 400) 0)) 6 | 'true) 7 | ([year] (when (=:= (rem year 100) 0)) 8 | 'false) 9 | ([year] (when (=:= (rem year 4) 0)) 10 | 'true) 11 | ([_] 12 | 'false)) 13 | -------------------------------------------------------------------------------- /exercises/practice/leap/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/leap/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/leap/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/leap/src/leap.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'leap', 3 | [{description, "exercism.org - leap"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['leap']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/leap/src/leap.lfe: -------------------------------------------------------------------------------- 1 | (defmodule leap 2 | (export (leap-year 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/leap/test/leap-tests.lfe: -------------------------------------------------------------------------------- 1 | (defmodule leap-tests 2 | (behaviour ltest-unit) 3 | (export all)) 4 | 5 | (include-lib "ltest/include/ltest-macros.lfe") 6 | 7 | (deftest leap-year 8 | (is (leap:leap-year 1996))) 9 | 10 | (deftest non-leap-year 11 | (is-not (leap:leap-year 1997))) 12 | 13 | (deftest century 14 | (is-not (leap:leap-year 1900))) 15 | 16 | (deftest fourth-century 17 | (is (leap:leap-year 2400))) 18 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "kahgoh" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/list-ops.lfe" 8 | ], 9 | "test": [ 10 | "test/list-ops-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Implement basic list operations." 21 | } 22 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/src/list-ops.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'list-ops', 3 | [{description, "exercism.org - list ops"}, 4 | {vsn, "0.0.1"}, 5 | {modules,['list-ops']}, 6 | {registered, []}, 7 | {applications, 8 | [kernel, stdlib]}, 9 | {included_applications, []}, 10 | {env, []}]}. 11 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/src/list-ops.lfe: -------------------------------------------------------------------------------- 1 | (defmodule list-ops 2 | (export (append 2) 3 | (concat 1) 4 | (filter 2) 5 | (length 1) 6 | (map 2) 7 | (foldl 3) 8 | (foldr 3) 9 | (reverse 1))) 10 | 11 | ; Please implement the exported function(s). 12 | 13 | -------------------------------------------------------------------------------- /exercises/practice/luhn/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/luhn/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/luhn/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/luhn/src/luhn.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'luhn', 3 | [{description, "exercism.org - luhn"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['luhn']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/luhn/src/luhn.lfe: -------------------------------------------------------------------------------- 1 | (defmodule luhn 2 | (export (valid? 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a string containing brackets `[]`, braces `{}`, parentheses `()`, or any combination thereof, verify that any and all pairs are matched and nested correctly. 4 | Any other characters should be ignored. 5 | For example, `"{what is (42)}?"` is balanced and `"[text}"` is not. 6 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/matching-brackets.lfe" 8 | ], 9 | "test": [ 10 | "test/matching-brackets-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Make sure the brackets and braces all match.", 21 | "source": "Ginna Baker" 22 | } 23 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/src/matching-brackets.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'matching-brackets', 3 | [{description, "exercism.org - matching brackets"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['matching-brackets']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/src/matching-brackets.lfe: -------------------------------------------------------------------------------- 1 | (defmodule matching-brackets 2 | (export (paired? 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/meetup/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "yurrriq" 4 | ], 5 | "contributors": [ 6 | "etrepum" 7 | ], 8 | "files": { 9 | "solution": [ 10 | "src/meetup.lfe" 11 | ], 12 | "test": [ 13 | "test/meetup-tests.lfe" 14 | ], 15 | "example": [ 16 | ".meta/example.lfe" 17 | ], 18 | "invalidator": [ 19 | "rebar.config", 20 | "rebar.lock" 21 | ] 22 | }, 23 | "blurb": "Calculate the date of meetups.", 24 | "source": "Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month" 25 | } 26 | -------------------------------------------------------------------------------- /exercises/practice/meetup/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/meetup/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/meetup/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/meetup/src/meetup.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'meetup', 3 | [{description, "exercism.org - meetup"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['meetup']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/meetup/src/meetup.lfe: -------------------------------------------------------------------------------- 1 | (defmodule meetup 2 | (export (schedule 4))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/nucleotide-count/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/nucleotide-count/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/nucleotide-count/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/nucleotide-count/src/nucleotide-count.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'nucleotide-count', 3 | [{description, "exercism.org - nucleotide count"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['nucleotide-count']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/nucleotide-count/src/nucleotide-count.lfe: -------------------------------------------------------------------------------- 1 | (defmodule nucleotide-count 2 | (export (counts 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to figure out if a sentence is a pangram. 4 | 5 | A pangram is a sentence using every letter of the alphabet at least once. 6 | It is case insensitive, so it doesn't matter if a letter is lower-case (e.g. `k`) or upper-case (e.g. `K`). 7 | 8 | For this exercise, a sentence is a pangram if it contains each of the 26 letters in the English alphabet. 9 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/pangram.lfe" 8 | ], 9 | "test": [ 10 | "test/pangram-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Determine if a sentence is a pangram.", 21 | "source": "Wikipedia", 22 | "source_url": "https://en.wikipedia.org/wiki/Pangram" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule pangram 2 | (export (pangram? 1))) 3 | 4 | (defun pangram? (sentence) 5 | (ordsets:is_subset (lists:seq #\a #\z) 6 | (ordsets:from_list (string:lowercase sentence)))) 7 | -------------------------------------------------------------------------------- /exercises/practice/pangram/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/pangram/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/pangram/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/pangram/src/pangram.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'pangram', 3 | [{description, "exercism.org - pangram"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['pangram']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/pangram/src/pangram.lfe: -------------------------------------------------------------------------------- 1 | (defmodule pangram 2 | (export (pangram? 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Count the frequency of letters in texts using parallel computation. 4 | 5 | Parallelism is about doing things in parallel that can also be done sequentially. 6 | A common example is counting the frequency of letters. 7 | Employ parallelism to calculate the total frequency of each letter in a list of texts. 8 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "yurrriq" 4 | ], 5 | "contributors": [ 6 | "tmcgilchrist" 7 | ], 8 | "files": { 9 | "solution": [ 10 | "src/parallel-letter-frequency.lfe" 11 | ], 12 | "test": [ 13 | "test/parallel-letter-frequency-tests.lfe" 14 | ], 15 | "example": [ 16 | ".meta/example.lfe" 17 | ], 18 | "invalidator": [ 19 | "rebar.config", 20 | "rebar.lock" 21 | ] 22 | }, 23 | "blurb": "Count the frequency of letters in texts using parallel computation." 24 | } 25 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule parallel-letter-frequency 2 | (export (dict 1))) 3 | 4 | (defun dict (strings) 5 | (let ((pid (spawn #'loop/0))) 6 | (lists:foreach (lambda (string) (! pid `#(string ,string))) strings) 7 | (! pid `#(done ,(self)))) 8 | (receive (freqs freqs))) 9 | 10 | (defun loop () (loop (dict:new))) 11 | 12 | (defun loop (freqs) 13 | (receive 14 | (`#(string ,string) (loop (lists:foldl #'frequency/2 freqs string))) 15 | (`#(done ,from) (! from freqs)))) 16 | 17 | (defun frequency (char freqs) (dict:update_counter char 1 freqs)) 18 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/src/parallel-letter-frequency.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'parallel-letter-frequency', 3 | [{description, "exercism.org - parallel letter frequency"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['parallel-letter-frequency']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/src/parallel-letter-frequency.lfe: -------------------------------------------------------------------------------- 1 | (defmodule parallel-letter-frequency 2 | (export (dict 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/parallel-letter-frequency/test/parallel-letter-frequency-tests.lfe: -------------------------------------------------------------------------------- 1 | (defmodule parallel-letter-frequency-tests 2 | (behaviour ltest-unit) 3 | (export all)) 4 | 5 | (include-lib "ltest/include/ltest-macros.lfe") 6 | 7 | (deftest single 8 | (let ((frequencies (parallel-letter-frequency:dict '["asd"]))) 9 | (is-equal (lists:sort (dict:to_list frequencies)) 10 | '[#(#\a 1) #(#\d 1) #(#\s 1)]))) 11 | 12 | (deftest double 13 | (let ((frequencies (parallel-letter-frequency:dict '["asd" "asd"]))) 14 | (is-equal (lists:sort (dict:to_list frequencies)) 15 | '[#(#\a 2) #(#\d 2) #(#\s 2)]))) 16 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/pascals-triangle.lfe" 8 | ], 9 | "test": [ 10 | "test/pascals-triangle-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Compute Pascal's triangle up to a given number of rows.", 21 | "source": "Pascal's Triangle at Wolfram Math World", 22 | "source_url": "https://www.wolframalpha.com/input/?i=Pascal%27s+triangle" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule pascals-triangle 2 | (export (rows 1))) 3 | 4 | (defun rows (count) 5 | (lists:reverse (do-rows count '()))) 6 | 7 | (defun do-rows 8 | ((0 rows) 9 | rows) 10 | ((count '()) 11 | (do-rows (- count 1) '((1)))) 12 | ((count (= (cons head _) row)) 13 | (do-rows (- count 1) (cons (next-row head) row)))) 14 | 15 | (defun next-row (row) 16 | (lists:zipwith (lambda (a b) (+ a b)) 17 | (++ '(0) row) 18 | (++ row '(0)))) 19 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/src/pascals-triangle.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'pascals-triangle', 3 | [{description, "exercism.org - pascal's triangle"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['pascals-triangle']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/src/pascals-triangle.lfe: -------------------------------------------------------------------------------- 1 | (defmodule pascals-triangle 2 | (export (rows 1))) 3 | 4 | ; Please implement the exported function(s). 5 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule perfect-numbers 2 | (export (classify 1))) 3 | 4 | (defun classify (number) 5 | (if (=< number 0) 6 | 'false 7 | (let ((sum-of-factors (lists:sum (factors-of number)))) 8 | (label number sum-of-factors)))) 9 | 10 | (defun factors-of (number) 11 | (lists:filter (lambda (x) (=:= 0 (rem number x))) 12 | (lists:seq 1 (div number 2)))) 13 | 14 | (defun label 15 | ((number number) 16 | 'perfect) 17 | ((number sum) (when (< number sum)) 18 | 'abundant) 19 | ((number sum) (when (> number sum)) 20 | 'deficient)) 21 | 22 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/src/perfect-numbers.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'perfect-numbers', 3 | [{description, "exercism.org - perfect numbers"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['perfect-numbers']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/src/perfect-numbers.lfe: -------------------------------------------------------------------------------- 1 | (defmodule perfect-numbers 2 | (export (classify 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/src/phone-number.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'phone-number', 3 | [{description, "exercism.org - phone number"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['phone-number']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/src/phone-number.lfe: -------------------------------------------------------------------------------- 1 | (defmodule phone-number 2 | (export (clean 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "kahgoh" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/protein-translation.lfe" 8 | ], 9 | "test": [ 10 | "test/protein-translation-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Translate RNA sequences into proteins.", 21 | "source": "Tyler Long" 22 | } 23 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/src/protein-translation.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'protein-translation', 3 | [{description, "exercism.org - protein translation"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['protein-translation']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/src/protein-translation.lfe: -------------------------------------------------------------------------------- 1 | (defmodule protein-translation 2 | (export (proteins 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/src/queen-attack.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'queen-attack', 3 | [{description, "exercism.org - queen attack"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['queen-attack']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/src/queen-attack.lfe: -------------------------------------------------------------------------------- 1 | (defmodule queen-attack 2 | (export (create 2) 3 | (can-attack 2))) 4 | 5 | ; Please implement the exported function(s). 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Raindrops is a slightly more complex version of the FizzBuzz challenge, a classic interview question. 4 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule raindrops 2 | (export (convert 1))) 3 | 4 | (defun fill-string 5 | (("" value) (integer_to_list value)) 6 | ((content _value) content) 7 | ) 8 | 9 | (defun check-sound 10 | ((word 0) word) 11 | ((_word _value) "") 12 | ) 13 | 14 | (defun convert 15 | ((value) 16 | (fill-string 17 | (lists:concat 18 | (list 19 | (check-sound "Pling" (rem value 3)) 20 | (check-sound "Plang" (rem value 5)) 21 | (check-sound "Plong" (rem value 7)) 22 | ) 23 | ) 24 | value 25 | ) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/src/raindrops.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'raindrops', 3 | [{description, "exercism.org - raindrops"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['raindrops']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/src/raindrops.lfe: -------------------------------------------------------------------------------- 1 | (defmodule raindrops 2 | (export (convert 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/resistor-color-duo.lfe" 8 | ], 9 | "test": [ 10 | "test/resistor-color-duo-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Convert color codes, as used on resistors, to a numeric value.", 21 | "source": "Maud de Vries, Erik Schierboom", 22 | "source_url": "https://github.com/exercism/problem-specifications/issues/1464" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule resistor-color-duo 2 | (export (value 1))) 3 | 4 | (defun value 5 | (((list first second _)) 6 | (value (list first second))) 7 | (((list first second)) 8 | (+ (* 10 (color-code first)) 9 | (color-code second)))) 10 | 11 | (defun color-code 12 | (("black") 0) 13 | (("brown") 1) 14 | (("red") 2) 15 | (("orange") 3) 16 | (("yellow") 4) 17 | (("green") 5) 18 | (("blue") 6) 19 | (("violet") 7) 20 | (("grey") 8) 21 | (("white") 9) 22 | ((_) 'false)) 23 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.3"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/src/resistor-color-duo.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'resistor-color-duo', 3 | [{description, "exercism.org - resistor color duo"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['resistor-color-duo']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/src/resistor-color-duo.lfe: -------------------------------------------------------------------------------- 1 | (defmodule resistor-color-duo 2 | (export (value 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/resistor-color.lfe" 8 | ], 9 | "test": [ 10 | "test/resistor-color-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Convert a resistor band's color to its numeric representation.", 21 | "source": "Maud de Vries, Erik Schierboom", 22 | "source_url": "https://github.com/exercism/problem-specifications/issues/1458" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule resistor-color 2 | (export (color-code 1) (colors 0))) 3 | 4 | (defun color-code 5 | (("black") 0) 6 | (("brown") 1) 7 | (("red") 2) 8 | (("orange") 3) 9 | (("yellow") 4) 10 | (("green") 5) 11 | (("blue") 6) 12 | (("violet") 7) 13 | (("grey") 8) 14 | (("white") 9) 15 | ((_) 'false)) 16 | 17 | (defun colors () 18 | '("black" 19 | "brown" 20 | "red" 21 | "orange" 22 | "yellow" 23 | "green" 24 | "blue" 25 | "violet" 26 | "grey" 27 | "white")) 28 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color/src/resistor-color.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'resistor-color', 3 | [{description, "exercism.org - resistor color"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['resistor-color']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color/src/resistor-color.lfe: -------------------------------------------------------------------------------- 1 | (defmodule resistor-color 2 | (export (color-code 1) 3 | (colors 0))) 4 | 5 | ; Please implement the exported function(s). 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to reverse a given string. 4 | 5 | Some examples: 6 | 7 | - Turn `"stressed"` into `"desserts"`. 8 | - Turn `"strops"` into `"sports"`. 9 | - Turn `"racecar"` into `"racecar"`. 10 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Reversing strings (reading them from right to left, rather than from left to right) is a surprisingly common task in programming. 4 | 5 | For example, in bioinformatics, reversing the sequence of DNA or RNA strings is often important for various analyses, such as finding complementary strands or identifying palindromic sequences that have biological significance. 6 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/reverse-string.lfe" 8 | ], 9 | "test": [ 10 | "test/reverse-string-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Reverse a given string.", 21 | "source": "Introductory challenge to reverse an input string", 22 | "source_url": "https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule reverse 2 | (export (string 1))) 3 | 4 | (defun string (str) 5 | (lists:reverse str)) -------------------------------------------------------------------------------- /exercises/practice/reverse-string/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/src/reverse-string.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'reverse-string', 3 | [{description, "exercism.org - reverse string"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | [reverse]}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/src/reverse-string.lfe: -------------------------------------------------------------------------------- 1 | (defmodule reverse-string 2 | (export (reverse 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule rna-transcription 2 | (export (to-rna 1))) 3 | 4 | (defun to-rna (strand) (lists:map #'transcribe-to-rna/1 strand)) 5 | 6 | (defun transcribe-to-rna 7 | ([#\G] #\C) 8 | ([#\C] #\G) 9 | ([#\T] #\A) 10 | ([#\A] #\U)) 11 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/src/rna-transcription.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'rna-transcription', 3 | [{description, "exercism.org - rna transcription"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['rna-transcription']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/src/rna-transcription.lfe: -------------------------------------------------------------------------------- 1 | (defmodule rna-transcription 2 | (export (to-rna 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "yurrriq" 4 | ], 5 | "contributors": [ 6 | "NobbZ", 7 | "tmcgilchrist" 8 | ], 9 | "files": { 10 | "solution": [ 11 | "src/robot-simulator.lfe" 12 | ], 13 | "test": [ 14 | "test/robot-simulator-tests.lfe" 15 | ], 16 | "example": [ 17 | ".meta/example.lfe" 18 | ], 19 | "invalidator": [ 20 | "rebar.config", 21 | "rebar.lock" 22 | ] 23 | }, 24 | "blurb": "Write a robot simulator.", 25 | "source": "Inspired by an interview question at a famous company." 26 | } 27 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/src/robot-simulator.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'robot-simulator', 3 | [{description, "exercism.org - robot simulator"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['robot-simulator']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/src/robot-simulator.lfe: -------------------------------------------------------------------------------- 1 | (defmodule robot-simulator 2 | (export (create 0) 3 | (place 3) 4 | (direction 1) 5 | (position 1) 6 | (left 1) 7 | (right 1) 8 | (advance 1) 9 | (control 2) 10 | 11 | ;; gen_server stuff 12 | (init 1) 13 | (handle_cast 2) 14 | (handle_call 3)) 15 | (behaviour gen_server)) 16 | 17 | ; Please implement the exported function(s). 18 | 19 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Your task is to convert a number from Arabic numerals to Roman numerals. 4 | 5 | For this exercise, we are only concerned about traditional Roman numerals, in which the largest number is MMMCMXCIX (or 3,999). 6 | 7 | ~~~~exercism/note 8 | There are lots of different ways to convert between Arabic and Roman numerals. 9 | We recommend taking a naive approach first to familiarise yourself with the concept of Roman numerals and then search for more efficient methods. 10 | 11 | Make sure to check out our Deep Dive video at the end to explore the different approaches you can take! 12 | ~~~~ 13 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "kahgoh" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/roman-numerals.lfe" 8 | ], 9 | "test": [ 10 | "test/roman-numerals-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Convert modern Arabic numbers into Roman numerals.", 21 | "source": "The Roman Numeral Kata", 22 | "source_url": "https://codingdojo.org/kata/RomanNumerals/" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/src/roman-numerals.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'roman-numerals', 3 | [{description, "exercism.org - roman numerals"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['roman-numerals']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/src/roman-numerals.lfe: -------------------------------------------------------------------------------- 1 | (defmodule roman-numerals 2 | (export (roman 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/rotational-cipher.lfe" 8 | ], 9 | "test": [ 10 | "test/rotational-cipher-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.", 21 | "source": "Wikipedia", 22 | "source_url": "https://en.wikipedia.org/wiki/Caesar_cipher" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/src/rotational-cipher.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'rotational-cipher', 3 | [{description, "exercism.org exercise: Rotational Cipher"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['rotational-cipher']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/src/rotational-cipher.lfe: -------------------------------------------------------------------------------- 1 | (defmodule rotational-cipher 2 | (export (rotate 2))) 3 | 4 | ; Please implement the rotate function. 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | [Scrabble][wikipedia] is a word game where players place letter tiles on a board to form words. 4 | Each letter has a value. 5 | A word's score is the sum of its letters' values. 6 | 7 | [wikipedia]: https://en.wikipedia.org/wiki/Scrabble 8 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/scrabble-score.lfe" 8 | ], 9 | "test": [ 10 | "test/scrabble-score-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Given a word, compute the Scrabble score for that word.", 21 | "source": "Inspired by the Extreme Startup game", 22 | "source_url": "https://github.com/rchatley/extreme_startup" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule scrabble-score 2 | (export (score 1))) 3 | 4 | (defun score (word) 5 | (lists:sum (lists:map #'value-of/1 (string:lowercase word)))) 6 | 7 | (defun value-of 8 | ([#\a] 1) 9 | ([#\e] 1) 10 | ([#\i] 1) 11 | ([#\o] 1) 12 | ([#\u] 1) 13 | ([#\l] 1) 14 | ([#\n] 1) 15 | ([#\r] 1) 16 | ([#\s] 1) 17 | ([#\t] 1) 18 | ([#\d] 2) 19 | ([#\g] 2) 20 | ([#\b] 3) 21 | ([#\c] 3) 22 | ([#\m] 3) 23 | ([#\p] 3) 24 | ([#\f] 4) 25 | ([#\h] 4) 26 | ([#\v] 4) 27 | ([#\w] 4) 28 | ([#\y] 4) 29 | ([#\k] 5) 30 | ([#\j] 8) 31 | ([#\x] 8) 32 | ([#\q] 10) 33 | ([#\z] 10) 34 | ([_] 0)) 35 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/src/scrabble-score.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'scrabble-score', 3 | [{description, "exercism.org - scrabble score"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['scrabble-score']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/src/scrabble-score.lfe: -------------------------------------------------------------------------------- 1 | (defmodule scrabble-score 2 | (export (score 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You are starting a secret coding club with some friends and friends-of-friends. 4 | Not everyone knows each other, so you and your friends have decided to create a secret handshake that you can use to recognize that someone is a member. 5 | You don't want anyone who isn't in the know to be able to crack the code. 6 | 7 | You've designed the code so that one person says a number between 1 and 31, and the other person turns it into a series of actions. 8 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/secret-handshake.lfe" 8 | ], 9 | "test": [ 10 | "test/secret-handshake-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.", 21 | "source": "Bert, in Mary Poppins", 22 | "source_url": "https://www.imdb.com/title/tt0058331/quotes/?item=qt0437047" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/src/secret-handshake.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'secret-handshake', 3 | [{description, "exercism.org - secret handshake"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['secret-handshake']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/src/secret-handshake.lfe: -------------------------------------------------------------------------------- 1 | (defmodule secret-handshake 2 | (export (commands 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/series/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a string of digits, output all the contiguous substrings of length `n` in that string in the order that they appear. 4 | 5 | For example, the string "49142" has the following 3-digit series: 6 | 7 | - "491" 8 | - "914" 9 | - "142" 10 | 11 | And the following 4-digit series: 12 | 13 | - "4914" 14 | - "9142" 15 | 16 | And if you ask for a 6-digit series from a 5-digit string, you deserve whatever you get. 17 | 18 | Note that these series are only required to occupy _adjacent positions_ in the input; 19 | the digits need not be _numerically consecutive_. 20 | -------------------------------------------------------------------------------- /exercises/practice/series/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule series 2 | (export (from-string 2))) 3 | 4 | (defun from-string (width string) (rows (length string) width string)) 5 | 6 | (defun rows 7 | ([length width (= (cons _head tail) string)] (when (> length width)) 8 | (let ((`#(,row ,_rest) (lists:split width string))) 9 | (cons row (rows (- length 1) width tail)))) 10 | ([_length _width string] 11 | `(,string))) 12 | -------------------------------------------------------------------------------- /exercises/practice/series/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/series/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/series/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/series/src/series.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'series', 3 | [{description, "exercism.org - series"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['series']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/series/src/series.lfe: -------------------------------------------------------------------------------- 1 | (defmodule series 2 | (export (from-string 2))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/series/test/series-tests.lfe: -------------------------------------------------------------------------------- 1 | (defmodule series-tests 2 | (behaviour ltest-unit) 3 | (export all)) 4 | 5 | (include-lib "ltest/include/ltest-macros.lfe") 6 | 7 | (deftest three 8 | (is-equal (series:from-string 3 "01234") '("012" "123" "234"))) 9 | 10 | (deftest four 11 | (is-equal (series:from-string 4 "01234") '("0123" "1234"))) 12 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You bought a big box of random computer parts at a garage sale. 4 | You've started putting the parts together to build custom computers. 5 | 6 | You want to test the performance of different combinations of parts, and decide to create your own benchmarking program to see how your computers compare. 7 | You choose the famous "Sieve of Eratosthenes" algorithm, an ancient algorithm, but one that should push your computers to the limits. 8 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "kahgoh" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/sieve.lfe" 8 | ], 9 | "test": [ 10 | "test/sieve-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.", 21 | "source": "Sieve of Eratosthenes at Wikipedia", 22 | "source_url": "https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/sieve/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/sieve/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/sieve/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/sieve/src/sieve.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'sieve', 3 | [{description, "exercism.org - sieve"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['sieve']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/sieve/src/sieve.lfe: -------------------------------------------------------------------------------- 1 | (defmodule sieve 2 | (export (primes 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/space-age/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule space-age 2 | (export (age-on 2))) 3 | 4 | (defun age-on (planet seconds) (/ seconds (seconds-per-year planet))) 5 | 6 | (defun seconds-per-year 7 | (['earth] (* 365.25 24 60 60)) 8 | (['mercury] (seconds-per-year 0.2408467)) 9 | (['venus] (seconds-per-year 0.61519726)) 10 | (['mars] (seconds-per-year 1.8808158)) 11 | (['jupiter] (seconds-per-year 11.862615)) 12 | (['saturn] (seconds-per-year 29.447498)) 13 | (['uranus] (seconds-per-year 84.016846)) 14 | (['neptune] (seconds-per-year 164.79132)) 15 | ([n] (* n (seconds-per-year 'earth)))) 16 | -------------------------------------------------------------------------------- /exercises/practice/space-age/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/space-age/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/space-age/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/space-age/src/space-age.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'space-age', 3 | [{description, "exercism.org - space age"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['space-age']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/space-age/src/space-age.lfe: -------------------------------------------------------------------------------- 1 | (defmodule space-age 2 | (export (age-on 2))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/square-root/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/square-root.lfe" 8 | ], 9 | "test": [ 10 | "test/square-root-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Given a natural radicand, return its square root.", 21 | "source": "wolf99", 22 | "source_url": "https://github.com/exercism/problem-specifications/pull/1582" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/square-root/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule square-root 2 | (export (calculate 1))) 3 | 4 | (defun calculate 5 | ((1) 1) 6 | ((radicand) (sqrt radicand 7 | (div radicand 2)))) 8 | 9 | (defun sqrt 10 | ((radicand guess) (when (=:= radicand 11 | (* guess guess))) 12 | guess) 13 | ((radicand guess) 14 | (sqrt radicand (div (+ guess 15 | (div radicand guess)) 16 | 2)))) 17 | -------------------------------------------------------------------------------- /exercises/practice/square-root/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/square-root/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/square-root/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/square-root/src/square-root.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'square-root', 3 | [{description, "exercism.org - square root"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['square-root']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/square-root/src/square-root.lfe: -------------------------------------------------------------------------------- 1 | (defmodule square-root 2 | (export (calculate 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/square-root/test/square-root-tests.lfe: -------------------------------------------------------------------------------- 1 | (defmodule square-root-tests 2 | (behaviour ltest-unit) 3 | (export all)) 4 | 5 | (include-lib "ltest/include/ltest-macros.lfe") 6 | 7 | (deftest root-of-1 8 | (is-equal 1 (square-root:calculate 1))) 9 | 10 | (deftest root-of-4 11 | (is-equal 2 (square-root:calculate 4))) 12 | 13 | (deftest root-of-25 14 | (is-equal 5 (square-root:calculate 25))) 15 | 16 | (deftest root-of-81 17 | (is-equal 9 (square-root:calculate 81))) 18 | 19 | (deftest root-of-196 20 | (is-equal 14 (square-root:calculate 196))) 21 | 22 | (deftest root-of-65025 23 | (is-equal 255 (square-root:calculate 65025))) 24 | -------------------------------------------------------------------------------- /exercises/practice/strain/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule strain 2 | (export (keep 2) 3 | (discard 2))) 4 | 5 | (defun keep 6 | ([_f []] ()) 7 | ([f (cons h t)] 8 | (if (funcall f h) 9 | (cons h (keep f t)) 10 | (keep f t)))) 11 | 12 | ;;; Could also be written as a list comprehension: 13 | ;; 14 | ;; (defun keep' (f lst) 15 | ;; (lc ((<- x lst) 16 | ;; (funcall f x)) 17 | ;; x)) 18 | 19 | (defun discard (f lst) (keep (lambda (x) (not (funcall f x))) lst)) 20 | -------------------------------------------------------------------------------- /exercises/practice/strain/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/strain/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/strain/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/strain/src/strain.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'strain', 3 | [{description, "exercism.org - strain"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['strain']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/strain/src/strain.lfe: -------------------------------------------------------------------------------- 1 | (defmodule strain 2 | (export (keep 2) 3 | (discard 2))) 4 | 5 | ; Please implement the exported function(s). 6 | 7 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You work for a company that makes an online, fantasy-survival game. 4 | 5 | When a player finishes a level, they are awarded energy points. 6 | The amount of energy awarded depends on which magical items the player found while exploring that level. 7 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule sum-of-multiples 2 | (export (sum-of-multiples 2))) 3 | 4 | (defun sum-of-multiples (multiples n) 5 | (lists:foldl 6 | (lambda (x sum) 7 | (if (any-multiple? multiples x) 8 | (+ sum x) 9 | sum)) 10 | 0 11 | (lists:seq 1 (- n 1)))) 12 | 13 | (defun any-multiple? (lst x) (lists:any (lambda (n) (=:= (rem x n) 0)) lst)) 14 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/src/sum-of-multiples.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'sum-of-multiples', 3 | [{description, "exercism.org - sum of multiples"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['sum-of-multiples']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/src/sum-of-multiples.lfe: -------------------------------------------------------------------------------- 1 | (defmodule sum-of-multiples 2 | (export (sum-of-multiples 2))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/triangle/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | # Instructions append 2 | 3 | For this exercise, scalene triangles are instead defined as those where only two sides are equal. Equilateral and isosceles triangles are still defined as above. 4 | -------------------------------------------------------------------------------- /exercises/practice/triangle/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/triangle.lfe" 8 | ], 9 | "test": [ 10 | "test/triangle-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Determine if a triangle is equilateral, isosceles, or scalene.", 21 | "source": "The Ruby Koans triangle project, parts 1 & 2", 22 | "source_url": "https://web.archive.org/web/20220831105330/http://rubykoans.com" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/triangle/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule triangle 2 | (export (kind 3))) 3 | 4 | (defun kind 5 | ((A B C) (when (and (=< A 0) 6 | (=< B 0) 7 | (=< C 0))) 8 | 'false) 9 | ((A B C) (when (or (>= C (+ A B)) 10 | (>= B (+ A C)) 11 | (>= A (+ B C)))) 12 | 'false) 13 | ((A A A) 14 | 'equilateral) 15 | ((A A _) 16 | 'isosceles) 17 | ((A _ A) 18 | 'isosceles) 19 | ((_ A A) 20 | 'isosceles) 21 | ((_ _ _) 22 | 'scalene)) 23 | -------------------------------------------------------------------------------- /exercises/practice/triangle/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/triangle/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/triangle/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/triangle/src/triangle.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'triangle', 3 | [{description, "exercism.org - triangle"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['triangle']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/triangle/src/triangle.lfe: -------------------------------------------------------------------------------- 1 | (defmodule triangle 2 | (export (kind 3))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/trinary/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule trinary 2 | (export (to-decimal 1))) 3 | 4 | (defun BASE () 3) 5 | 6 | (defun to-decimal (string) (to-decimal string 0)) 7 | 8 | (defun to-decimal 9 | ([() acc] acc) 10 | ([`(,digit . ,digits) acc] (when (>= digit #\0) (=< digit #\2)) 11 | (to-decimal digits (+ (digit->int digit) (* acc (BASE))))) 12 | ([_string _acc] 0)) 13 | 14 | (defun digit->int 15 | ([digit] (when (>= digit #\0) (=< digit #\2)) 16 | (- digit #\0))) 17 | -------------------------------------------------------------------------------- /exercises/practice/trinary/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/trinary/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/trinary/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/trinary/src/trinary.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'trinary', 3 | [{description, "exercism.org - trinary"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['trinary']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/trinary/src/trinary.lfe: -------------------------------------------------------------------------------- 1 | (defmodule trinary 2 | (export (to-decimal 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/trinary/test/trinary-tests.lfe: -------------------------------------------------------------------------------- 1 | (defmodule trinary-tests 2 | (behaviour ltest-unit) 3 | (export all)) 4 | 5 | (include-lib "ltest/include/ltest-macros.lfe") 6 | 7 | (deftestgen trinary-to-decimal 8 | (lc ((<- `#(,decimal ,trinary) 9 | '[#(1 "1") #(2 "2") #(3 "10") #(4 "11") #(9 "100") #(14 "112") 10 | #(26 "222") #(42 "1120") #(32091 "1122000120") #(0 "carrot")])) 11 | `#(,(lists:concat `["trinary " ,trinary " is decimal " ,decimal]) 12 | ,(_assertEqual decimal (trinary:to-decimal trinary))))) 13 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | In some English accents, when you say "two for" quickly, it sounds like "two fer". 4 | Two-for-one is a way of saying that if you buy one, you also get one for free. 5 | So the phrase "two-fer" often implies a two-for-one offer. 6 | 7 | Imagine a bakery that has a holiday offer where you can buy two cookies for the price of one ("two-fer one!"). 8 | You take the offer and (very generously) decide to give the extra cookie to someone else in the queue. 9 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/two-fer.lfe" 8 | ], 9 | "test": [ 10 | "test/two-fer-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Create a sentence of the form \"One for X, one for me.\".", 21 | "source_url": "https://github.com/exercism/problem-specifications/issues/757" 22 | } 23 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/.meta/example.lfe: -------------------------------------------------------------------------------- 1 | (defmodule two-fer 2 | (export (two-fer 1))) 3 | 4 | (defun two-fer 5 | (("") "One for you, one for me.") 6 | ((name) (++ "One for " name ", one for me."))) 7 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/src/two-fer.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'two-fer', 3 | [{description, "exercism.org - two fer"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['two-fer']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/src/two-fer.lfe: -------------------------------------------------------------------------------- 1 | (defmodule two-fer 2 | (export (two-fer 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/test/two-fer-tests.lfe: -------------------------------------------------------------------------------- 1 | (defmodule two-fer-tests 2 | (behaviour ltest-unit) 3 | (export all)) 4 | 5 | (include-lib "ltest/include/ltest-macros.lfe") 6 | 7 | (deftest no-name-given 8 | (is-equal "One for you, one for me." (two-fer:two-fer ""))) 9 | 10 | (deftest a-name-given 11 | (is-equal "One for Alice, one for me." (two-fer:two-fer "Alice"))) 12 | 13 | (deftest another-name-given 14 | (is-equal "One for Bob, one for me." (two-fer:two-fer "Bob"))) 15 | -------------------------------------------------------------------------------- /exercises/practice/word-count/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You teach English as a foreign language to high school students. 4 | 5 | You've decided to base your entire curriculum on TV shows. 6 | You need to analyze which words are used, and how often they're repeated. 7 | 8 | This will let you choose the simplest shows to start with, and to gradually increase the difficulty as time passes. 9 | -------------------------------------------------------------------------------- /exercises/practice/word-count/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/word-count/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/word-count/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/word-count/src/word-count.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'word-count', 3 | [{description, "exercism.org - word count" 4 | }, 5 | {vsn, "0.0.1"}, 6 | {modules, 7 | ['word-count']}, 8 | {registered, []}, 9 | {applications, 10 | [kernel, stdlib]}, 11 | {included_applications, []}, 12 | {env, []}]}. 13 | -------------------------------------------------------------------------------- /exercises/practice/word-count/src/word-count.lfe: -------------------------------------------------------------------------------- 1 | (defmodule word-count 2 | (export (count 1))) 3 | 4 | ; Please implement the exported function(s). 5 | 6 | -------------------------------------------------------------------------------- /exercises/practice/yacht/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Each year, something new is "all the rage" in your high school. 4 | This year it is a dice game: [Yacht][yacht]. 5 | 6 | The game of Yacht is from the same family as Poker Dice, Generala and particularly Yahtzee, of which it is a precursor. 7 | The game consists of twelve rounds. 8 | In each, five dice are rolled and the player chooses one of twelve categories. 9 | The chosen category is then used to score the throw of the dice. 10 | 11 | [yacht]: https://en.wikipedia.org/wiki/Yacht_(dice_game) 12 | -------------------------------------------------------------------------------- /exercises/practice/yacht/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "BNAndras" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "src/yacht.lfe" 8 | ], 9 | "test": [ 10 | "test/yacht-tests.lfe" 11 | ], 12 | "example": [ 13 | ".meta/example.lfe" 14 | ], 15 | "invalidator": [ 16 | "rebar.config", 17 | "rebar.lock" 18 | ] 19 | }, 20 | "blurb": "Score a single throw of dice in the game Yacht.", 21 | "source": "James Kilfiger, using Wikipedia", 22 | "source_url": "https://en.wikipedia.org/wiki/Yacht_(dice_game)" 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/yacht/Makefile: -------------------------------------------------------------------------------- 1 | ERL := $(shell which erl) 2 | REBAR3 := $(shell which rebar3) 3 | 4 | null := 5 | space := $(null) # 6 | comma := , 7 | 8 | ifeq ($(ERL),) 9 | $(error Can't find Erlang executable 'erl') 10 | else ifeq ($(REBAR3),) 11 | $(error Can't find rebar3) 12 | endif 13 | 14 | compile: ; $(REBAR3) compile 15 | 16 | clean: ; $(REBAR3) clean 17 | 18 | .PHONY: test 19 | test: 20 | $(REBAR3) eunit \ 21 | -m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) 22 | -------------------------------------------------------------------------------- /exercises/practice/yacht/rebar.config: -------------------------------------------------------------------------------- 1 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 2 | 3 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 4 | 5 | {deps, [{lfe, "2.1.3"}]}. 6 | 7 | {profiles, 8 | [{test, 9 | [{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, 10 | {deps, 11 | [{ltest, "0.13.8"}]}]}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/yacht/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /exercises/practice/yacht/src/yacht.app.src: -------------------------------------------------------------------------------- 1 | %% -*- erlang -*- 2 | {application, 'yacht', 3 | [{description, "exercism.org - yacht"}, 4 | {vsn, "0.0.1"}, 5 | {modules, 6 | ['yacht']}, 7 | {registered, []}, 8 | {applications, 9 | [kernel, stdlib]}, 10 | {included_applications, []}, 11 | {env, []}]}. 12 | -------------------------------------------------------------------------------- /exercises/practice/yacht/src/yacht.lfe: -------------------------------------------------------------------------------- 1 | (defmodule yacht 2 | (export (score 2))) 3 | 4 | ; Please implement the exported function(s). 5 | -------------------------------------------------------------------------------- /exercises/shared/.docs/help.md: -------------------------------------------------------------------------------- 1 | # Help 2 | 3 | To get help if you're having trouble, you can use one of the following resources: 4 | 5 | - [LFE Documentation](http://docs.lfe.io/) 6 | - [StackOverflow](http://stackoverflow.com/questions/tagged/lfe) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. 7 | -------------------------------------------------------------------------------- /exercises/shared/.docs/tests.md: -------------------------------------------------------------------------------- 1 | # Tests 2 | 3 | To run the tests, open a terminal window and run the following from the exercise directory: 4 | 5 | ```sh 6 | make test 7 | ``` 8 | -------------------------------------------------------------------------------- /rebar.config: -------------------------------------------------------------------------------- 1 | {project_app_dirs, ["exercises/*"]}. 2 | 3 | {plugins, [{rebar3_lfe, "0.4.10"}]}. 4 | 5 | {provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. 6 | 7 | {deps, [{lfe, "2.1.3"}]}. 8 | 9 | {profiles, 10 | [{test, 11 | [{deps, 12 | [{ltest, "0.13.8"}]}]}]}. 13 | -------------------------------------------------------------------------------- /rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} 8 | ]. 9 | --------------------------------------------------------------------------------