Skip to content

Commit ccf23e3

Browse files
benjieleebyron
andauthored
Define Data Collections used in the spec (#1102)
* Define Data Collections used in the spec * Define what a collection is and integrate feedback * Lee editorial updates --------- Co-authored-by: Lee Byron <lee@leebyron.com>
1 parent ac483bd commit ccf23e3

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

spec/Appendix A -- Notation Conventions.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,36 @@ Fibonacci(number):
214214
- Return {Fibonacci(previousNumber)} + {Fibonacci(previousPreviousNumber)}.
215215

216216
Note: Algorithms described in this document are written to be easy to
217-
understand. Implementers are encouraged to include equivalent but optimized
218-
implementations.
217+
understand. Implementers are encouraged to include observably equivalent but
218+
optimized implementations.
219+
220+
## Data Collections
221+
222+
Algorithms within this specification refer to abstract data collection types to
223+
express normative structural, uniqueness, and ordering requirements. Temporary
224+
data collections internal to an algorithm use these types to best describe
225+
expected behavior, but implementers are encouraged to provide observably
226+
equivalent but optimized implementations. Implementations may use any data
227+
structure as long as the expected requirements are met.
228+
229+
**List**
230+
231+
:: A _list_ is an ordered collection of values which may contain duplicates. A
232+
value added to a list is ordered after existing values.
233+
234+
**Set**
235+
236+
:: A _set_ is a collection of values which must not contain duplicates.
237+
238+
:: An _ordered set_ is a set which has a defined order. A value added to an
239+
ordered set, which does not already contain that value, is ordered after
240+
existing values.
241+
242+
**Map**
243+
244+
:: A _map_ is a collection of entries, each of which has a key and value. Each
245+
entry has a unique key, and can be directly referenced by that key.
246+
247+
:: An _ordered map_ is a map which has a defined order. An entry added to an
248+
ordered map, which does not have an entry with that key, is ordered after
249+
existing entries.

spec/GraphQL.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,15 @@ algorithm step (e.g. "Let completedResult be the result of calling
8888
CompleteValue()") is to be interpreted as having at least the same level of
8989
requirement as the algorithm containing that step.
9090

91-
Conformance requirements expressed as algorithms can be fulfilled by an
92-
implementation of this specification in any way as long as the perceived result
93-
is equivalent. Algorithms described in this document are written to be easy to
94-
understand. Implementers are encouraged to include equivalent but optimized
95-
implementations.
91+
Conformance requirements expressed as algorithms and data collections can be
92+
fulfilled by an implementation of this specification in any way as long as the
93+
perceived result is equivalent. Algorithms described in this document are
94+
written to be easy to understand. Implementers are encouraged to include
95+
equivalent but optimized implementations.
9696

9797
See [Appendix A](#sec-Appendix-Notation-Conventions) for more details about the
98-
definition of algorithms and other notational conventions used in this document.
98+
definition of algorithms, data collections, and other notational conventions
99+
used in this document.
99100

100101
**Non-Normative Portions**
101102

0 commit comments

Comments
 (0)