Skip to content

Commit

Permalink
[v3] Prepare for v3 (#869)
Browse files Browse the repository at this point in the history
* Shared docs

docs: move shared documents to exercises/shared/.docs

* Extract concepts of v2 book-store exercise

* Extract Concepts from v2 exercise: protein-translation

Extract Concepts from v2 exercise: protein-translation

Co-authored-by: Erik Schierboom <[email protected]>

* Merge pull request #294 from exercism/reference/exercise-concepts/bob.md

Extract Concepts from v2 exercise: bob

* Extract Concepts from v2 exercise: meetup

* Extract Concepts from v2 exercise: meetup

* Update languages/reference/exercise-concepts/meetup.md

Co-Authored-By: Rob Keim <[email protected]>

* Update languages/reference/exercise-concepts/meetup.md

Co-Authored-By: Rob Keim <[email protected]>

* Update meetup.md

Co-authored-by: Rob Keim <[email protected]>

* Add strings Concept Exercise

Add strings concept exercise

* Remove primary heading for documents in `.docs` folder

* Add docs/reference split

* [Docs] Move implementing-a-concept-exercise.md to reference folder
* [Docs] Move reference documents to docs folder
* [Docs] Update to student-facing docs
* [Docs] Add new issue template

Co-Authored-By: Jeremy Walker <[email protected]>
Co-Authored-By: Victor Goff <[email protected]>
Co-authored-by: Sascha Mann <[email protected]>

* Reference string concatenation document in strings exercise

* Add no-code part to hints.md

* Use plural for test files

* Update track-specific files in example

* Update track-specific files in example

* Update new-concept-exercise-strings.md

* Implement new Concept exercise dates

* Add dates exercise

* Update languages/exercises/concept/dates/.meta/design.md

Co-Authored-By: Rob Keim <[email protected]>

Co-authored-by: Rob Keim <[email protected]>

* Implement new Concept Exercise: numbers

Implement new Concept Exercise: numbers

Co-authored-by: Rob Keim <[email protected]>

* Add if/elif/else mention to introduction of numbers exercise

* Update new concept exercise issue example

* Simplify display of returned value

* Make function to implement explicit in instructions

* Add Booleans exercise

Add Booleans exercise

Co-Authored-By: Rob Keim <[email protected]>

* Add Lists exercise

Add Lists exercise

Co-authored-by: Rob Keim <[email protected]>

* Clarify syntax in introduction document

[Docs] Clarify syntax in introduction document

Co-Authored-By: Jeremy Walker <[email protected]>

* Add operators information to Numbers exercise

* Add skip to tests

* Add code syntax samples to lists exercise

* Add code syntax samples to strings exercise

* Add code syntax samples to numbers exercise

* Create DateTime in dates exercise

Create DateTime in dates exercise

Co-Authored-By: Rob Keim <[email protected]>

* Add recursion exercise

Add recursion exercise

Co-Authored-By: Rob Keim <[email protected]>

* Add discriminated-unions exercise

* Add numbers-floating-point exercise

* Be explicit about creating DateTime instance

* Make after.md required

* Improve Skip string #1047

Co-authored-by: wolf99 <[email protected]>

* Add Basics exercise

Add Values exercise

Co-authored-by: Jeremy Walker <[email protected]>
Co-authored-by: Rob Keim <[email protected]>
Co-authored-by: Sascha Mann <[email protected]>

* Simplify concepts

Simplify concepts
Rename exercises

* Add syntax mention to after.md document description

The after.md document should include newly introduced syntax.

* Add syntax examples to after document of lists exercise

* Add syntax examples to after document of recursion exercise

* Simplify introduction

* Add test that requires tail-recursive solution

* Add syntax examples to after document of discriminated-unions exercise

* Add syntax examples to after document of booleans exercise

* Add syntax examples to after document of strings exercise

* Add syntax examples to after document of numbers exercise

* Remove pattern matching introduction from discriminated-unions exercise

* Remove list pattern matching introduction from recursion exercise

* Add pattern matching to lists exercise

* Add pattern-matching exercise

* Add syntax examples to after document of numbers-floating-point exercise

* Use consistent text in instructions

* Add higher-order-functions as prerequisite for recursion exercise

* Add equality operators to numbers exercise

* Add source and versioninfo to exercise config

Co-authored-by: Sascha Mann <[email protected]>
Co-authored-by: Erik Schierboom <[email protected]>

* Remove unused examples

* Add reference to required reading in implementing guide

[Docs] Add reference to required reading in implementing guide

* Use updated config.json format

* Add reference to Concept Exercise Anatomy video

[Docs] Add reference to Concept Exercise Anatomy video

* Add script to format code

* Format code

* Fix naming of floating-point-numbers files

* Fix missing module name

* Format using Prettier

[Docs] Format using Prettier

* Cross-reference concept exercise file information

[Docs] Cross-reference concept exercise file information

* Update implementing guide

* Update files to match slug

[Datetimes] Rename files to match slug

* Don't use features unknown to student in example

* Update packages

* Remove out of scope item

* Update documentation

* [Lists] Add note about when to use List vs property

* [Lists] Add list creation functions

* Add arrays exercise

Add arrays exercise

Co-authored-by: Tim Austin <[email protected]>
Co-authored-by: Rob Keim <[email protected]>

* Use consistent headings in documentation

* Typos

* Typos

* Add underscore notation to numbers exercise

* Add records exercise

* Add records exercise

Co-authored-by: Jeremy Walker <[email protected]>

* Remove top-level header from design.md files

* Add syntax highlighting

* Fix typo in docs of pattern-matching exercise

* Clarify recursion text

* Remove unneeded representer and analyzer sections

* Remove unneeded representer and analyzer sections

* Remove unneeded text from design.md

* Improve elapsed time for basics exercise

* Use float instead of double

* Remove goal from design.md

* [C#] Remove goal from design docs
* Remove goal from design docs
* [Elixir] Remove goal from design docs

* Add records exercise

Add records exercise

Co-authored-by: Rob Keim <[email protected]>

* Remove duplicate datetime format from the appointment scheduler story

* Fix lasagna spelling

Update instructions.md

* Fix broken links in pattern-matching hints

* Add stubs for concept documents

* discriminated-unions - replace about.md file with concept files

* Pre-populate discriminated-unions concept's about.md file from after.md file

* Pre-populate discriminated-unions concept's links.json file from after.md file

* discriminated-unions - Remove after.md document

* Update links.json

* arrays - replace about.md file with concept files

* Pre-populate arrays concept's about.md file from after.md file

* Pre-populate arrays concept's links.json file from after.md file

* arrays - Remove after.md document

* Update links.json

* booleans - replace about.md file with concept files

* Pre-populate booleans concept's about.md file from after.md file

* Pre-populate booleans concept's links.json file from after.md file

* booleans - Remove after.md document

* Update links.json

* datetimes - replace about.md file with concept files

* Pre-populate datetimes concept's about.md file from after.md file

* Pre-populate datetimes concept's links.json file from after.md file

* datetimes - Remove after.md document

* Update links.json

* floating-point-numbers - replace about.md file with concept files

* Pre-populate floating-point-numbers concept's about.md file from after.md file

* Pre-populate floating-point-numbers concept's links.json file from after.md file

* floating-point-numbers - Remove after.md document

* Update links.json

* Update about.md

* lists - replace about.md file with concept files

* Pre-populate lists concept's about.md file from after.md file

* Pre-populate lists concept's links.json file from after.md file

* lists - Remove after.md document

* Update links.json

* Update links.json

* pattern-matching - replace about.md file with concept files

* Pre-populate pattern-matching concept's about.md file from after.md file

* Pre-populate pattern-matching concept's links.json file from after.md file

* pattern-matching - Remove after.md document

* Update links.json

* records - replace about.md file with concept files

* Pre-populate records concept's about.md file from after.md file

* Pre-populate records concept's links.json file from after.md file

* records - Remove after.md document

* Update links.json

* recursion - replace about.md file with concept files

* Pre-populate recursion concept's about.md file from after.md file

* Pre-populate recursion concept's links.json file from after.md file

* recursion - Remove after.md document

* Update links.json

* strings - replace about.md file with concept files

* Pre-populate strings concept's about.md file from after.md file

* Pre-populate strings concept's links.json file from after.md file

* strings - Remove after.md document

* Update about.md

* Update links.json

* basics - replace about.md file with concept files

* Pre-populate basics concept's about.md file from after.md file

* Pre-populate basics concept's links.json file from after.md file

* basics - Remove after.md document

* Update links.json

* numbers - replace about.md file with concept files

* Pre-populate conditionals concept's about.md file from after.md file

* Pre-populate conditionals concept's links.json file from after.md file

* Pre-populate numbers concept's about.md file from after.md file

* Pre-populate numbers concept's links.json file from after.md file

* numbers - Remove after.md document

* Update about.md

* Update links.json

* Update links.json

* Update about.md

* Update about.md

* Update links.json

* Update about.md

* [CI] Format code

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix typos

* fixing typos and Prerequisites

* run prettier

* remove anoying submodule

* Add editor key to exercises

* Add concept headings to introduction.md

* Rename exercises

Rename exercises

* Use same names as C# track

* Add description of concept documents

[Docs] Add description of concept documents

Co-authored-by: Jeremy Walker <[email protected]>

* Fix package versions

* Fix invalid link in valentines-day hints

* Make meta-config files check pass

* Upgrade to .NET 5

* Cleanup instructions headings

* Add concept introductions

* Add concept introductions

* [CI] Format code

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Replace custom docs with concept doc

* Remove tasks heading

* Convert example to exemplar

* Rename example files to exemplar

See exercism/docs#23

* [Docs] Correct .meta/example references to .meta/exemplar

* [Docs] Use exemplar instead of example

* [Docs] Update example name in file listings

* [Julia] Convert to exemplar.jl

* [elm] Rename .meta/Cook.elm to .meta/Examplar.elm

* [elm] Rename .meta/Examplar.elm .meta/Exemplar.elm

Co-authored-by: Matthieu Pizenberg <[email protected]>

* Convert editor key in .meta/config.json files

* Convert editor key to files

* Add missing "files" field to .meta/config.json files

* Add exemplar files to .meta/config.json

* Add common-lisp exemplar to template

* [v3] Move existing exercises to exercises/practice

* [v3] Add version property to config.json

* [v3] Add status to config.json

* [v3] Add slug to config.json

* [v3] Add status for deprecated practice exercises in config.json

* [v3] Re-order practice exercises in config.json

* [v3] Remove deprecated properties from practice exercises in config.json

* [v3] Add name property to practice exercises in config.json

* [v3] Add (empty) prerequisites property to practice exercises in config.json

* [v3] Move exercises to practice exercises property in config.json

* [v3] Move foregone exercises to exercises property in config.json

* [v3] Add concept exercises to config.json

* [v3] Add wip status to concept exercises in config.json

* [v3] Add concepts to config.json

* [v3] Add key features to config.json

* [v3] Add tags to config.json

* [v3] Add configlet CI workflow

* [v3] Update fetch-configlet script to work with configlet v3

* [v3] Add dependabot to keep GHA dependencies up-to-date

* [v3] Convert relative v3 links to absolute links

Co-authored-by: Rob Keim <[email protected]>
Co-authored-by: Jeremy Walker <[email protected]>
Co-authored-by: Victor Goff <[email protected]>
Co-authored-by: Sascha Mann <[email protected]>
Co-authored-by: wolf99 <[email protected]>
Co-authored-by: wolf99 <[email protected]>
Co-authored-by: Tim Austin <[email protected]>
Co-authored-by: Mike May <[email protected]>
Co-authored-by: Angelika Tyborska <[email protected]>
Co-authored-by: currentlyuntitledz <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: valentin-p <[email protected]>
Co-authored-by: Matthieu Pizenberg <[email protected]>
  • Loading branch information
14 people authored Jan 29, 2021
1 parent 2182d9b commit 701299d
Show file tree
Hide file tree
Showing 1,037 changed files with 6,665 additions and 1,393 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

updates:

# Keep dependencies for GitHub Actions up-to-date
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
16 changes: 16 additions & 0 deletions .github/workflows/configlet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Configlet CI

on: [push, pull_request, workflow_dispatch]

jobs:
configlet:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f

- name: Fetch configlet
uses: exercism/github-actions/configlet-ci@main

- name: Configlet Linter
run: configlet lint .
91 changes: 56 additions & 35 deletions bin/fetch-configlet
Original file line number Diff line number Diff line change
@@ -1,37 +1,58 @@
#!/bin/bash

LATEST=https://api.github.com/repos/exercism/configlet/releases/latest

OS=$(
case $(uname) in
(Darwin*)
echo "mac";;
(Linux*)
echo "linux";;
(*)
echo "linux";;
esac)
ARCH=$(
case $(uname -m) in
(*64*)
echo 64bit;;
(*686*)
echo 32bit;;
(*386*)
echo 32bit;;
(*)
echo 64bit;;
esac)
FILENAME="configlet-${OS}-${ARCH}.tgz"
if [ -z "${GITHUB_TOKEN}" ]
then
HEADER=""
else
HEADER="authorization: Bearer ${GITHUB_TOKEN}"
#!/usr/bin/env bash

set -eo pipefail

readonly LATEST='https://api.github.com/repos/exercism/configlet/releases/latest'

case "$(uname)" in
Darwin*) os='mac' ;;
Linux*) os='linux' ;;
Windows*) os='windows' ;;
MINGW*) os='windows' ;;
MSYS_NT-*) os='windows' ;;
*) os='linux' ;;
esac

case "${os}" in
windows*) ext='zip' ;;
*) ext='tgz' ;;
esac

case "$(uname -m)" in
*64*) arch='64bit' ;;
*686*) arch='32bit' ;;
*386*) arch='32bit' ;;
*) arch='64bit' ;;
esac

curlopts=(
--silent
--show-error
--fail
--location
--retry 3
)

if [[ -n "${GITHUB_TOKEN}" ]]; then
curlopts+=(--header "authorization: Bearer ${GITHUB_TOKEN}")
fi

URL=$(curl --header $HEADER -s $LATEST | awk -v filename=$FILENAME '$1 ~ /browser_download_url/ && $2 ~ filename { print $2 }' | tr -d '"')
curl --header $HEADER -s --location $URL | tar xz -C bin/
suffix="${os}-${arch}.${ext}"

get_download_url() {
curl "${curlopts[@]}" --header 'Accept: application/vnd.github.v3+json' "${LATEST}" |
grep "\"browser_download_url\": \".*/download/.*/configlet.*${suffix}\"$" |
cut -d'"' -f4
}

download_url="$(get_download_url)"
output_dir="bin"
output_path="${output_dir}/latest-configlet.${ext}"
curl "${curlopts[@]}" --output "${output_path}" "${download_url}"

case "${ext}" in
*zip) unzip "${output_path}" -d "${output_dir}" ;;
*) tar xzf "${output_path}" -C "${output_dir}" ;;
esac

rm -f "${output_path}"
34 changes: 18 additions & 16 deletions bin/fetch-configlet.ps1
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
Function DownloadUrl ([string] $FileName, $Headers) {
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest"
$json = Invoke-RestMethod -Headers $Headers -Uri $latestUrl
$json.assets | Where-Object { $_.browser_download_url -match $FileName } | Select-Object -ExpandProperty browser_download_url
}
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

Function Headers {
If ($GITHUB_TOKEN) { $headers = @{ Authorization = "Bearer ${GITHUB_TOKEN}" } } Else { $headers = @{ } }
$requestOpts = @{
Headers = If ($env:GITHUB_TOKEN) { @{ Authorization = "Bearer ${env:GITHUB_TOKEN}" } } Else { @{ } }
MaximumRetryCount = 3
RetryIntervalSec = 1
}

Function Arch {
If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" }
$arch = If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" }
$fileName = "configlet-windows-$arch.zip"

Function Get-DownloadUrl {
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest"
Invoke-RestMethod -Uri $latestUrl -PreserveAuthorizationOnRedirect @requestOpts
| Select-Object -ExpandProperty assets
| Where-Object { $_.browser_download_url -match $FileName }
| Select-Object -ExpandProperty browser_download_url
}

$arch = Arch
$headers = Headers
$fileName = "configlet-windows-$arch.zip"
$downloadUrl = Get-DownloadUrl
$outputDirectory = "bin"
$outputFile = Join-Path -Path $outputDirectory -ChildPath $fileName
$zipUrl = DownloadUrl -FileName $fileName -Headers $headers

Invoke-WebRequest -Headers $headers -Uri $zipUrl -OutFile $outputFile
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts
Expand-Archive $outputFile -DestinationPath $outputDirectory -Force
Remove-Item -Path $outputFile
Remove-Item -Path $outputFile
54 changes: 54 additions & 0 deletions concepts/arrays/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
An [`array`][arrays] in F# is a mutable collection of zero or more values with a fixed length. This means that once an array has been created, its size cannot change, but its values can. The values in an array must all have the same type. [Arrays can be defined as follows][creating-arrays]:

```fsharp
let empty = [| |]
let emptyAlternative = Array.empty
let singleValue = [| 5 |]
let singleValueAlternative = Array.singleton 5
let threeValues = [| "a"; "b"; "c" |]
```

Elements can be assigned to an array or retrieved from it [using an index][array-indexer]. F# arrays are zero-based, meaning that the first element's index is always zero:

```fsharp
let numbers = [2; 3; 5]
// Update value in array
numbers.[2] <- 9
// Read value from array
numbers.[2]
// => 9
```

Arrays are manipulated by functions and operators defined in the [`Array` module][array-module]. Some of these functions are also available as [properties][array-properties] of an `array` instance:

```fsharp
Array.length [| 7; 8 |] // => 2
[| 7; 8 |].Length // => 2
```

There is no right or wrong option here. In general, the functions in the `Array` module play better with type inference, whereas the properties allow for more concise code.

The [_array pattern_][array-pattern] allows pattern matching on arrays:

```fsharp
let describe array =
match array with
| [| |] -> "Empty"
| [| 1; 2; three |] -> sprintf "1, 2, %d" three
| _ -> "Other"
describe [| |] // => "Empty"
describe [| 1; 2; 4 |] // => "1, 2, 4"
describe [| 5; 7; 9 |] // => "Other"
```

[arrays]: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/arrays
[creating-arrays]: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/arrays#creating-arrays
[array-indexer]: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/arrays#accessing-elements
[array-pattern]: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/pattern-matching#array-pattern
[array-module]: https://msdn.microsoft.com/visualfsharpdocs/conceptual/collections.array-module-%5bfsharp%5d
[array-members]: https://docs.microsoft.com/en-us/dotnet/api/system.array?view=netcore-3.1
38 changes: 38 additions & 0 deletions concepts/arrays/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
An `array` in F# is a mutable collection of zero or more values with a fixed length. This means that once an array has been created, its size cannot change, but its values can. The values in an array must all have the same type. Arrays can be defined as follows:

```fsharp
let empty = [| |]
let emptyAlternative = Array.empty
let singleValue = [| 5 |]
let singleValueAlternative = Array.singleton 5
let threeValues = [| "a"; "b"; "c" |]
```

Elements can be assigned to an array or retrieved from it using an index. F# arrays are zero-based, meaning that the first element's index is always zero:

```fsharp
let numbers = [| 2; 3; 5 |]
// Update value in array
numbers.[2] <- 9
// Read value from array
numbers.[2]
// => 9
```

Arrays are either manipulated by functions and operators defined in the `Array` module, or manually using pattern matching using the _array_ pattern:

```fsharp
let describe array =
match array with
| [| |] -> "Empty"
| [| 1; 2; three |] -> sprintf "1, 2, %d" three
| _ -> "Other"
describe [| |] // => "Empty"
describe [| 1; 2; 4 |] // => "1, 2, 4"
describe [| 5; 7; 9 |] // => "Other"
```
14 changes: 14 additions & 0 deletions concepts/arrays/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"url": "https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/arrays",
"description": "Arrays"
},
{
"url": "https://msdn.microsoft.com/visualfsharpdocs/conceptual/collections.array-module-%5bfsharp%5d",
"description": "Array module"
},
{
"url": "https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/pattern-matching#array-pattern",
"description": "Pattern matching arrays"
}
]
75 changes: 75 additions & 0 deletions concepts/basics/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
In F#, everything that has a type and can be defined is known as a _value_. That includes booleans, integers and lists, but also functions. Integer values are defined as one or more (consecutive) digits and support the [default mathematical operators][operators].

Assigning a value to a name is referred to as a _binding_. [Bindings][bindings] are immutable, which makes them similar to constants in other languages. Bindings are defined using the `let` keyword.

As F# is a statically-typed language, each binding has a type. Specifying a binding's type is optional for most bindings, as F#'s _type inference_ can usually infer the type based on their value.

```fsharp
// Automatically inferred type
let fingers = 10
```

[Functions][functions] are also regular bindings, but with one or more parameters. A function automatically returns its last expression. Type inference also works for most functions, by analyzing what values the function is called with and what value the function returns.

```fsharp
// Automatically inferred types for parameters and return type
let add x y = x + y
```

Invoking a function is done by specifying its name and passing arguments for each of the function's parameters.

```fsharp
let five = add 2 3
```

If a binding's type cannot be inferred, the compiler will report an error. To fix this, make the binding's type explicit.

```fsharp
// Explicit type annotation
let fingers: int = 10
// Explicit type annotation (also for parameters)
let add (x: int) (y: int): int = x + y
```

Bindings in F# can only be used _after_ they have been defined. Using a binding before it has been defined results in a compile error.

```fsharp
// Compile error as the add binding has not yet been defined
// let seven = add 3 + 4
let add x y = x + y
```

Significant whitespace is used to define scope, by indenting code with spaces relative to the line declaring the binding. The default convention is to use four spaces for indentation.

```fsharp
let toes =
let left = 5
let right = 5
left + right
let multiplyPlusTwo x y =
let product = x * y
product + 2
// Trying to access the left, right or product bindings
// here would result in a compile error
```

F# bindings (which include functions) are usually organized in modules. A module groups related functionality and is defined using the `module` keyword. The module definition must precede its bindings:

```fsharp
module Calculator
let pi = 3.14
let add x y = x + y
```

F# supports two types of [comments][comments]. Single line comments are preceded by `//` and multiline comments are inserted between `(*` and `*)`.

[bindings]: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/values/#binding-a-value
[functions]: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/functions/#remarks
[operators]: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/symbol-and-operator-reference/arithmetic-operators
[comments]: https://www.javatpoint.com/f-sharp-comments
Loading

0 comments on commit 701299d

Please sign in to comment.