exercism / exercism/swift

[v3] Implement new Concept Exercise: map and flatMap

Offen
#416 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Swift
Sterne
122
Forks
165
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

This issue describes how to implement the map concept exercise for the Swift track.

## Getting started

**Please please please read the docs before starting.** Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read the following documents:

- [The features of v3][docs-features-of-v3].
- [Rationale for v3][docs-rationale-for-v3].
- [What are concept exercises and how are they structured?][docs-concept-exercises]

Please also watch the following video:

- [The Anatomy of a Concept Exercise][anatomy-of-a-concept-exercise].

## Goal

This concept exercise should convey a basic understanding of how to map in Swift.

## Learning objectives

- What is `map`?
- Sequence.map
- Dictionary.mapValues
- Optional.map
- What is `flatMap`?
- Sequence.flatMap
- Optional.flatMap

## Out of Scope

- `compactMap`
- `filter`
- `reduce`

## Concepts

- `map`
- `flatMap`

## Prerequisites

- `generics`
- `functions`
- `higher-order-functions`
- `closures`
- `loops`

## Resources to refer to

### Hints

- [Sequence.map][sequence-map-docs]
- [Dictionary.map][dictionary-map-docs]
- [Dictionary.mapValues][dictionary-mapvalues-docs]
- [Optional.map][optional-map-docs]
- [Sequence.flatMap][sequence-flatmap-docs]
- [Optional.flatMap][optional-flatmap-docs]

### After

- [Sequence.map][sequence-map-docs]
- [Sequence.compactMap][sequence-compactmap-docs]
- [Dictionary.map][dictionary-map-docs]
- [Dictionary.mapValues][dictionary-mapvalues-docs]
- [Dictionary.compactMap][dictionary-compactmap-docs]
- [Dictionary.compactMapValues][dictionary-compactmapvalues-docs]
- [Optional.map][optional-map-docs]
- [Sequence.flatMap][sequence-flatmap-docs]
- [Optional.flatMap][optional-flatmap-docs]

## Representer

TBD

## Analyzer

TBD

## Implementing

See [the Swift track implementation guide][swift-implementing-concept-exercises] for guidance.

## Help

If you have any questions while implementing the exercise, please post the questions as comments in this issue.

[swift-implementing-concept-exercises]: https://github.com/wneumann/v3/blob/master/languages/swift/reference/implementing-a-concept-exercise.md
[docs-concept-exercises]: ../../../docs/concept-exercises.md
[docs-rationale-for-v3]: ../../../docs/rationale-for-v3.md
[docs-features-of-v3]: ../../../docs/features-of-v3.md
[anatomy-of-a-concept-exercise]: https://www.youtube.com/watch?v=gkbBqd7hPrA

[sequence-map-docs]: https://developer.apple.com/documentation/swift/sequence/3018373-map
[optional-map-docs]: https://developer.apple.com/documentation/swift/optional/1539476-map
[dictionary-map-docs]: https://developer.apple.com/documentation/swift/dictionary/3017871-map
[dictionary-mapvalues-docs]: https://developer.apple.com/documentation/swift/dictionary/2995348-mapvalues
[sequence-compactmap-docs]: https://developer.apple.com/documentation/swift/sequence/2950916-compactmap
[dictionary-compactmap-docs]: https://developer.apple.com/documentation/swift/dictionary/2957714-compactmap
[dictionary-compactmapvalues-docs]: https://developer.apple.com/documentation/swift/dictionary/3081323-compactmapvalues
[sequence-flatmap-docs]: https://developer.apple.com/documentation/swift/sequence/2905332-flatmap
[optional-flatmap-docs]: https://developer.apple.com/documentation/swift/optional/1540500-flatmap

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.