{"id":16702173,"url":"https://github.com/vkatsuba/enn","last_synced_at":"2025-07-29T04:05:32.852Z","repository":{"id":117539347,"uuid":"207639880","full_name":"vkatsuba/enn","owner":"vkatsuba","description":":man_teacher: Solutions of Erlang 99 Problems","archived":false,"fork":false,"pushed_at":"2020-01-31T16:17:18.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T01:30:47.936Z","etag":null,"topics":["99problems","erlang","functional-programming","ninety-nine-erlang-problems","ninety-nine-problems"],"latest_commit_sha":null,"homepage":"https://github.com/vkatsuba/enn","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vkatsuba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-10T18:57:35.000Z","updated_at":"2020-01-31T17:02:46.000Z","dependencies_parsed_at":"2023-07-29T08:31:54.216Z","dependency_job_id":null,"html_url":"https://github.com/vkatsuba/enn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkatsuba%2Fenn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkatsuba%2Fenn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkatsuba%2Fenn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkatsuba%2Fenn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vkatsuba","download_url":"https://codeload.github.com/vkatsuba/enn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243538116,"owners_count":20307101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["99problems","erlang","functional-programming","ninety-nine-erlang-problems","ninety-nine-problems"],"created_at":"2024-10-12T18:47:03.435Z","updated_at":"2025-03-14T06:43:55.133Z","avatar_url":"https://github.com/vkatsuba.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# enn - Erlang Ninety Nine Problems\n**enn** is small project of **Erlang Ninety Nine Problems**. Here provided a simple solution of **Erlang Ninety Nine Problems**.\n\n## Contents\n* [Goals](#goals)\n* [Build \u0026 Run](#build--run)\n* [Documentation](#documentation)\n* [Erlang 99 Problems](#erlang-99-problems)\n  * [Problem 01](#problem-01)\n  * [Problem 02](#problem-02)\n  * [Problem 03](#problem-03)\n  * [Problem 04](#problem-04)\n  * [Problem 05](#problem-05)\n  * [Problem 06](#problem-06)\n  * [Problem 07](#problem-07)\n  * [Problem 08](#problem-08)\n  * [Problem 09](#problem-09)\n  * [Problem 10](#problem-10)\n  * [Problem 11](#problem-11)\n  * [Problem 12](#problem-12)\n  * [Problem 13](#problem-13)\n  * [Problem 14](#problem-14)\n  * [Problem 15](#problem-15)\n  * [Problem 16](#problem-16)\n  * [Problem 17](#problem-17)\n  * [Problem 18](#problem-18)\n  * [Problem 19](#problem-19)\n  * [Problem 20](#problem-20)\n* [Support](#support)\n\n## Goals\n**enn** aims to provide a simple solutions of **Erlang Ninety Nine Problems**.\n\n## Build \u0026 Run\n```sh\n$ git clone https://github.com/vkatsuba/enn.git\n$ cd enn\n$ make\n```\n## Documentation\nThe examples of 99 problems was get from [Ninety-Nine Lisp Problems](http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html)\n\n## Erlang 99 Problems\n\n### Problem 01\n(C) Find the last box of a list. **Example:**\n[p01.erl](https://github.com/vkatsuba/enn/blob/master/src/p01.erl)\n```erlang\n1\u003e p01:run([a, b, c, d]).\nd\n```\n\n### Problem 02\n(C) Find the last but one box of a list. **Example:**\n[p02.erl](https://github.com/vkatsuba/enn/blob/master/src/p02.erl)\n```erlang\n1\u003e p02:run([a, b, c, d]).\n[c,d]\n```\n\n### Problem 03\n(C) Find the K'th element of a list. **Example:**\n[p03.erl](https://github.com/vkatsuba/enn/blob/master/src/p03.erl)\n```erlang\n1\u003e p03:run([a, b, c, d, e], 3).\nс\n```\n\n### Problem 04\n(C) Find the number of elements of a list. **Example:**\n[p04.erl](https://github.com/vkatsuba/enn/blob/master/src/p04.erl)\n```erlang\n1\u003e p04:run([a, b, c, d, e]).\n5\n```\n\n### Problem 05\n(C) Reverse a list. **Example:**\n[p05.erl](https://github.com/vkatsuba/enn/blob/master/src/p05.erl)\n```erlang\n1\u003e p05:run([a, b, c, d, e]).\n[e,d,c,b,a]\n```\n\n### Problem 06\n(C) Find out whether a list is a palindrome. **Example:**\n[p06.erl](https://github.com/vkatsuba/enn/blob/master/src/p06.erl)\n```erlang\n1\u003e p06:run([a, b, c, b, a]).\ntrue\n```\n\n### Problem 07\n(C) Flatten a nested list structure. **Example:**\n[p07.erl](https://github.com/vkatsuba/enn/blob/master/src/p07.erl)\n```erlang\n1\u003e p07:run([[[a]], b, c, [d, [[e]]]]).\n[a,b,c,d,e]\n```\n\n### Problem 08\n(C) Eliminate consecutive duplicates of list elements. **Example:**\n[p08.erl](https://github.com/vkatsuba/enn/blob/master/src/p08.erl)\n```erlang\n1\u003e p08:run([a, a, a, b, b, b, b, c, d, d, d, d, e, e, e]).\n[a,b,c,d,e]\n```\n\n### Problem 09\n(C) Pack consecutive duplicates of list elements into sublists. If a list contains repeated elements they should be placed in separate sublists. **Example:**\n[p09.erl](https://github.com/vkatsuba/enn/blob/master/src/p09.erl)\n```erlang\n1\u003e p09:run([a, a, a, a, b, c, c, a, a, d, e, e, e, e]).\n[[a,a,a,a],[b],[c,c],[a,a],[d],[e,e,e,e]]\n```\n\n### Problem 10\n(C) Run-length encoding of a list.\nUse the result of problem P09 to implement the so-called run-length encoding data compression method.\nConsecutive duplicates of elements are encoded as lists (N E) where N is the number of duplicates of the element E. **Example:**\n[p10.erl](https://github.com/vkatsuba/enn/blob/master/src/p10.erl)\n```erlang\n1\u003e p10:run([a, a, a, a, b, c, c, a, a, d, e, e, e, e]).\n[{4,a},{1,b},{2,c},{2,a},{1,d},{4,e}]\n```\n\n### Problem 11\n(C) Modified run-length encoding.\nModify the result of problem P10 in such a way that if an element has no duplicates it is simply copied into the result list.\nOnly elements with duplicates are transferred as (N E) lists. **Example:**\n[p11.erl](https://github.com/vkatsuba/enn/blob/master/src/p11.erl)\n```erlang\n1\u003e p11:run([a, a, a, a, b, c, c, a, a, d, e, e, e, e]).\n[{4,a},b,{2,c},{2,a},d,{4,e}]\n```\n\n### Problem 12\n(C) Given a run-length code list generated as specified in problem P11. Construct its uncompressed version. **Example:**\n[p12.erl](https://github.com/vkatsuba/enn/blob/master/src/p12.erl)\n```erlang\n1\u003e p12:run([{4, a}, b, {2, c}, {2, a}, d, {4, e}]).\n[a,a,a,a,b,c,c,a,a,d,e,e,e,e]\n```\n\n### Problem 13\n(C) Run-length encoding of a list (direct solution).\nImplement the so-called run-length encoding data compression method directly.\nI.e. don't explicitly create the sublists containing the duplicates, as in problem P09, but only count them.\nAs in problem P11, simplify the result list by replacing the singleton lists (1 X) by X. **Example:**\n[p13.erl](https://github.com/vkatsuba/enn/blob/master/src/p13.erl)\n```erlang\n1\u003e p13:run([{4, a}, {1, b}, {2, c}, {2, a}, {1, d}, {4, e}]).\n[a,a,a,a,b,c,c,a,a,d,e,e,e,e]\n```\n\n### Problem 14\n(C) Duplicate the elements of a list. **Example:**\n[p14.erl](https://github.com/vkatsuba/enn/blob/master/src/p14.erl)\n```erlang\n1\u003e p14:run([a, b, c, d, e]).\n[a,a,b,b,c,c,d,d,e,e]\n```\n\n### Problem 15\n(C) Replicate the elements of a list a given number of times. **Example:**\n[p15.erl](https://github.com/vkatsuba/enn/blob/master/src/p15.erl)\n```erlang\n1\u003e p15:run([a, b, c, d, e], 3).\n[a,a,a,b,b,b,c,c,c,d,d,d,e,e,e]\n```\n### Problem 16\n(C) Drop every N'th element from a list. **Example:**\n[p16.erl](https://github.com/vkatsuba/enn/blob/master/src/p16.erl)\n```erlang\n1\u003e p16:run([a, b, c, d, e, f, g, h, i, k], 3).\n[a,b,d,e,g,h,k]\n```\n### Problem 17\n(C) Split a list into two parts; the length of the first part is given. **Example:**\n[p17.erl](https://github.com/vkatsuba/enn/blob/master/src/p17.erl)\n```erlang\n1\u003e p17:run([a, b, c, d, e, f, g, h, i, k], 3).\n[[a,b,c],[d,e,f,g,h,i,k]]\n```\n\n### Problem 18\n(C) Extract a slice from a list.\nGiven two indices, I and K, the slice is the list containing the elements between the I'th and K'th element of the original list (both limits included).\nStart counting the elements with 1. **Example:**\n[p18.erl](https://github.com/vkatsuba/enn/blob/master/src/p18.erl)\n```erlang\n1\u003e p18:run([a, b, c, d, e, f, g, h, i, k], 3, 7).\n[c,d,e,f,g]\n```\n\n### Problem 19\n(C) Rotate a list N places to the left.\nHint: Use the predefined functions length and append, as well as the result of problem P17. **Example:**\n[p19.erl](https://github.com/vkatsuba/enn/blob/master/src/p19.erl)\n```erlang\n1\u003e p19:run([a, b, c, d, e, f, g, h], 3).\n[d,e,f,g,h,a,b,c]\n2\u003e p19:run([a, b, c, d, e, f, g, h], -2).\n[g,h,a,b,c,d,e,f]\n```\n\n### Problem 20\n(C) Remove the K'th element from a list. **Example:**\n```erlang\n1\u003e p20:run([a, b, c, d], 2).\n[a,c,d]\n```\n\n### To be continued ...\n\n## Support\nv.katsuba.dev@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkatsuba%2Fenn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvkatsuba%2Fenn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkatsuba%2Fenn/lists"}