{"id":21371510,"url":"https://github.com/carreraprogrammer/clojure-challenge","last_synced_at":"2025-03-16T08:42:16.929Z","repository":{"id":145677327,"uuid":"597203188","full_name":"carreraprogrammer/clojure-challenge","owner":"carreraprogrammer","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-03T21:25:23.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T20:51:53.709Z","etag":null,"topics":["clojure","spec"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carreraprogrammer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-02-03T21:25:07.000Z","updated_at":"2023-06-13T03:54:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5a29a93-7dc3-4f17-b2db-72acb04a4bd8","html_url":"https://github.com/carreraprogrammer/clojure-challenge","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/carreraprogrammer%2Fclojure-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carreraprogrammer%2Fclojure-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carreraprogrammer%2Fclojure-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carreraprogrammer%2Fclojure-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carreraprogrammer","download_url":"https://codeload.github.com/carreraprogrammer/clojure-challenge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243846982,"owners_count":20357297,"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":["clojure","spec"],"created_at":"2024-11-22T08:13:43.185Z","updated_at":"2025-03-16T08:42:16.921Z","avatar_url":"https://github.com/carreraprogrammer.png","language":"Clojure","readme":"# Engineering Challenge\n\n## Getting started\n\nThis clojure challenge is made up of 3 questions that reflect the learning you accumulated for the past week. Complete the following instructions:\n\n1. Create a Gitlab repo of your own and fork this repo. When complete, send us the link to your challenge results.\n2. Duration: About 4 hours\n3. Install Cursive Plugin to Intellij and setup a clojure deps project. https://cursive-ide.com/userguide/deps.html  \n\n1. Enjoy!\n\n## Problems\n### Problem 1 Thread-last Operator -\u003e\u003e\nGiven the invoice defined in **invoice.edn** in this repo, use the thread-last -\u003e\u003e operator to find all invoice items that satisfy the given conditions. Please write a function that receives an invoice as an argument and returns all items that satisfy the conditions described below.\n#### Requirements\n- Load invoice to play around with the function like this:\n\n```\n(def invoice (clojure.edn/read-string (slurp \"invoice.edn\")))\n```\n\n#### Definitions\n- An invoice item is a clojure map { … } which has an :invoice-item/id field. EG.\n\n```\n{:invoice-item/id     \"ii2\"  \n  :invoice-item/sku \"SKU 2\"}\n```\n\n- An invoice has two fields :invoice/id (its identifier) and :invoice/items a vector of invoice items\n\n#### Invoice Item Conditions\n- At least have one item that has :iva 19%\n- At least one item has retention :ret\\_fuente 1%\n- Every item must satisfy EXACTLY one of the above two conditions. This means that an item cannot have BOTH :iva 19% and retention :ret\\_fuente 1%.\n## Problem 2: Core Generating Functions\n  Given the invoice defined in **invoice.json** found in this repo, generate an invoice that passes the spec **::invoice** defined in **invoice-spec.clj**. Write a function that as an argument receives a file name (a JSON file name in this case) and returns a clojure map such that\n\n```\n(s/valid? ::invoice invoice) =\u003e true \n```\n\nwhere invoice represents an invoice constructed from the JSON.\n## Problem 3: Test Driven Development\nGiven the function **subtotal** defined in **invoice-item.clj** in this repo, write at least five tests using clojure core **deftest** that demonstrates its correctness. This subtotal function calculates the subtotal of an invoice-item taking a discount-rate into account. Make sure the tests cover as many edge cases as you can!\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarreraprogrammer%2Fclojure-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarreraprogrammer%2Fclojure-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarreraprogrammer%2Fclojure-challenge/lists"}