{"id":21371537,"url":"https://github.com/carreraprogrammer/solutions-clojure","last_synced_at":"2025-03-16T08:42:16.846Z","repository":{"id":65692730,"uuid":"597204072","full_name":"carreraprogrammer/Solutions-clojure","owner":"carreraprogrammer","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-11T16:11:44.000Z","size":42,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-01-22T20:51:51.593Z","etag":null,"topics":["clojure","deftest","spec"],"latest_commit_sha":null,"homepage":"","language":"C++","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:28:39.000Z","updated_at":"2023-06-13T03:54:33.000Z","dependencies_parsed_at":"2023-02-18T19:01:24.134Z","dependency_job_id":null,"html_url":"https://github.com/carreraprogrammer/Solutions-clojure","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%2FSolutions-clojure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carreraprogrammer%2FSolutions-clojure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carreraprogrammer%2FSolutions-clojure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carreraprogrammer%2FSolutions-clojure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carreraprogrammer","download_url":"https://codeload.github.com/carreraprogrammer/Solutions-clojure/tar.gz/refs/heads/dev","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","deftest","spec"],"created_at":"2024-11-22T08:13:58.002Z","updated_at":"2025-03-16T08:42:16.814Z","avatar_url":"https://github.com/carreraprogrammer.png","language":"C++","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%2Fsolutions-clojure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarreraprogrammer%2Fsolutions-clojure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarreraprogrammer%2Fsolutions-clojure/lists"}