From cd7812d494b0cacba364c7f9fbc41438976a6614 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Sat, 17 Nov 2018 10:55:29 +0100 Subject: [PATCH 1/4] scripts: remove non-working Windows support in fetch-configlet --- bin/fetch-configlet | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/fetch-configlet b/bin/fetch-configlet index 4f64c5b9ad..3aa9d103b7 100755 --- a/bin/fetch-configlet +++ b/bin/fetch-configlet @@ -8,8 +8,6 @@ case $(uname) in echo "mac";; (Linux*) echo "linux";; - (Windows*) - echo "windows";; (*) echo "linux";; esac) From 7d184b9d4c15deec50482ab5b7e6278c22a30636 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Sat, 17 Nov 2018 10:55:50 +0100 Subject: [PATCH 2/4] scripts: add fetch-configlet PowerShell script --- bin/fetch-configlet.ps1 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 bin/fetch-configlet.ps1 diff --git a/bin/fetch-configlet.ps1 b/bin/fetch-configlet.ps1 new file mode 100644 index 0000000000..9e1caf68a1 --- /dev/null +++ b/bin/fetch-configlet.ps1 @@ -0,0 +1,30 @@ +Function RedirectLocationHeader([string]$url) { + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + + $latest = "https://github.com/exercism/configlet/releases/latest" + $request = [System.Net.WebRequest]::Create($latest) + $request.AllowAutoRedirect = $false + $response = $request.GetResponse() + + $response.GetResponseHeader("Location") +} + +Function LatestVersion { + $location = RedirectLocationHeader("https://github.com/exercism/configlet/releases/latest") + $location.Substring($location.LastIndexOf("/") + 1) +} + +Function Arch { + If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" } +} + +$arch = Arch +$version = LatestVersion +$fileName = "configlet-windows-$arch.zip" +$url = "https://github.com/exercism/configlet/releases/download/$version/$filename" +$outputDirectory = "bin" +$outputFile = Join-Path -Path $outputDirectory -ChildPath $fileName + +Invoke-WebRequest -Uri $url -OutFile $outputFile +Expand-Archive $outputFile -DestinationPath $outputDirectory -Force +Remove-Item -Path $outputFile \ No newline at end of file From 959ffcbef2375c58c76246283b5bcefb6e6d8739 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Sat, 17 Nov 2018 11:00:48 +0100 Subject: [PATCH 3/4] scripts: add script to update docs on Windows --- update-docs.ps1 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 update-docs.ps1 diff --git a/update-docs.ps1 b/update-docs.ps1 new file mode 100644 index 0000000000..e19c5360ce --- /dev/null +++ b/update-docs.ps1 @@ -0,0 +1,3 @@ +.\bin\fetch-configlet +.\bin\configlet generate . +Get-ChildItem -File -Path ".\config\patches" -Filter *.patch | % {& git apply $_.FullName} \ No newline at end of file From c4b7565b7779405539410131581a78eb023ccb54 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Sat, 17 Nov 2018 11:01:03 +0100 Subject: [PATCH 4/4] exercises: update README to latest version --- exercises/list-ops/README.md | 13 +++++++++++++ exercises/wordy/README.md | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/exercises/list-ops/README.md b/exercises/list-ops/README.md index 688416ce2d..0c800632e1 100644 --- a/exercises/list-ops/README.md +++ b/exercises/list-ops/README.md @@ -6,6 +6,19 @@ In functional languages list operations like `length`, `map`, and `reduce` are very common. Implement a series of basic list operations, without using existing functions. +The precise number and names of the operations to be implemented will be +track dependent to avoid conflicts with existing names, but the general +operations you will implement include: + +* `append` (*given two lists, add all items in the second list to the end of the first list*); +* `concatenate` (*given a series of lists, combine all items in all lists into one flattened list*); +* `filter` (*given a predicate and a list, return the list of all items for which `predicate(item)` is True*); +* `length` (*given a list, return the total number of items within it*); +* `map` (*given a function and a list, return the list of the results of applying `function(item)` on all items*); +* `foldl` (*given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left using `function(accumulator, item)`*); +* `foldr` (*given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right using `function(item, accumulator)`*); +* `reverse` (*given a list, return a list with all the original items, but in reversed order*); + ## Hints The `Foldl` and `Foldr` methods are "fold" functions, which is a concept well-known in the functional programming world, but less so in the object-oriented one. If you'd like more background information, check out this [fold](https://en.wikipedia.org/wiki/Fold_(higher-order_function)) page. diff --git a/exercises/wordy/README.md b/exercises/wordy/README.md index fdb1113785..a758eca5f0 100644 --- a/exercises/wordy/README.md +++ b/exercises/wordy/README.md @@ -2,6 +2,14 @@ Parse and evaluate simple math word problems returning the answer as an integer. +## Iteration 0 — Numbers + +Problems with no operations simply evaluate to the number given. + +> What is 5? + +Evaluates to 5. + ## Iteration 1 — Addition Add two numbers together. @@ -43,6 +51,14 @@ left-to-right, _ignoring the typical order of operations._ 15 (i.e. not 9) +## Iteration 4 — Errors + +The parser should reject: + +* Unsupported operations ("What is 52 cubed?") +* Non-math questions ("Who is the President of the United States") +* Word problems with invalid syntax ("What is 1 plus plus 2?") + ## Bonus — Exponentials If you'd like, handle exponentials.