@shd101wyy/yo 0.1.25 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/.github/skills/yo-async-effects/SKILL.md +4 -4
  2. package/.github/skills/yo-async-effects/async-effects-recipes.md +40 -40
  3. package/.github/skills/yo-core-patterns/SKILL.md +1 -1
  4. package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +30 -26
  5. package/.github/skills/yo-project-workflow/SKILL.md +6 -3
  6. package/.github/skills/yo-project-workflow/workflow-cheatsheet.md +34 -11
  7. package/.github/skills/yo-syntax/SKILL.md +7 -6
  8. package/.github/skills/yo-syntax/syntax-cheatsheet.md +78 -60
  9. package/.github/skills/yo-wasm-integration/wasm-integration-cheatsheet.md +3 -3
  10. package/README.md +10 -8
  11. package/out/cjs/index.cjs +583 -567
  12. package/out/cjs/yo-cli.cjs +664 -632
  13. package/out/cjs/yo-lsp.cjs +510 -485
  14. package/out/esm/index.mjs +538 -522
  15. package/out/types/src/codegen/codegen-c.d.ts +2 -2
  16. package/out/types/src/codegen/functions/collection.d.ts +2 -2
  17. package/out/types/src/codegen/functions/context.d.ts +3 -2
  18. package/out/types/src/codegen/types/collection.d.ts +2 -2
  19. package/out/types/src/codegen/utils/index.d.ts +3 -1
  20. package/out/types/src/doc/builder.d.ts +2 -2
  21. package/out/types/src/evaluator/calls/closure-type.d.ts +2 -2
  22. package/out/types/src/evaluator/calls/record-type.d.ts +11 -0
  23. package/out/types/src/evaluator/context.d.ts +8 -9
  24. package/out/types/src/evaluator/index.d.ts +3 -3
  25. package/out/types/src/evaluator/types/record.d.ts +14 -0
  26. package/out/types/src/evaluator/types/validation.d.ts +2 -2
  27. package/out/types/src/evaluator/values/anonymous-module.d.ts +5 -5
  28. package/out/types/src/evaluator/values/impl.d.ts +1 -1
  29. package/out/types/src/expr.d.ts +1 -4
  30. package/out/types/src/formatter.d.ts +11 -0
  31. package/out/types/src/function-value.d.ts +1 -1
  32. package/out/types/src/lsp/document-manager.d.ts +1 -1
  33. package/out/types/src/lsp/formatting.d.ts +2 -0
  34. package/out/types/src/module-manager.d.ts +3 -3
  35. package/out/types/src/tests/formatter.test.d.ts +1 -0
  36. package/out/types/src/types/creators.d.ts +3 -4
  37. package/out/types/src/types/definitions.d.ts +8 -19
  38. package/out/types/src/types/guards.d.ts +3 -3
  39. package/out/types/src/types/tags.d.ts +0 -1
  40. package/out/types/src/types/utils.d.ts +1 -1
  41. package/out/types/src/value-tag.d.ts +0 -1
  42. package/out/types/src/value.d.ts +6 -13
  43. package/out/types/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +1 -1
  45. package/std/alg/hash.yo +13 -21
  46. package/std/allocator.yo +25 -40
  47. package/std/async.yo +3 -7
  48. package/std/build.yo +105 -151
  49. package/std/cli/arg_parser.yo +184 -169
  50. package/std/collections/array_list.yo +350 -314
  51. package/std/collections/btree_map.yo +142 -131
  52. package/std/collections/deque.yo +132 -128
  53. package/std/collections/hash_map.yo +542 -566
  54. package/std/collections/hash_set.yo +623 -687
  55. package/std/collections/linked_list.yo +275 -293
  56. package/std/collections/ordered_map.yo +113 -85
  57. package/std/collections/priority_queue.yo +73 -73
  58. package/std/crypto/md5.yo +191 -95
  59. package/std/crypto/random.yo +56 -64
  60. package/std/crypto/sha256.yo +151 -107
  61. package/std/encoding/base64.yo +87 -81
  62. package/std/encoding/hex.yo +43 -50
  63. package/std/encoding/html.yo +56 -81
  64. package/std/encoding/html_char_utils.yo +7 -13
  65. package/std/encoding/html_entities.yo +2248 -2253
  66. package/std/encoding/json.yo +316 -224
  67. package/std/encoding/punycode.yo +86 -116
  68. package/std/encoding/toml.yo +67 -66
  69. package/std/encoding/utf16.yo +37 -44
  70. package/std/env.yo +62 -91
  71. package/std/error.yo +12 -20
  72. package/std/fmt/display.yo +5 -9
  73. package/std/fmt/index.yo +8 -14
  74. package/std/fmt/to_string.yo +330 -315
  75. package/std/fmt/writer.yo +58 -87
  76. package/std/fs/dir.yo +83 -102
  77. package/std/fs/file.yo +147 -180
  78. package/std/fs/metadata.yo +45 -78
  79. package/std/fs/temp.yo +55 -65
  80. package/std/fs/types.yo +27 -40
  81. package/std/fs/walker.yo +53 -68
  82. package/std/gc.yo +5 -8
  83. package/std/glob.yo +30 -43
  84. package/std/http/client.yo +107 -120
  85. package/std/http/http.yo +106 -96
  86. package/std/http/index.yo +4 -6
  87. package/std/imm/list.yo +88 -93
  88. package/std/imm/map.yo +528 -464
  89. package/std/imm/set.yo +52 -57
  90. package/std/imm/sorted_map.yo +340 -286
  91. package/std/imm/sorted_set.yo +57 -63
  92. package/std/imm/string.yo +404 -345
  93. package/std/imm/vec.yo +173 -181
  94. package/std/io/reader.yo +3 -6
  95. package/std/io/writer.yo +4 -8
  96. package/std/libc/assert.yo +5 -9
  97. package/std/libc/ctype.yo +32 -22
  98. package/std/libc/dirent.yo +26 -25
  99. package/std/libc/errno.yo +164 -90
  100. package/std/libc/fcntl.yo +52 -45
  101. package/std/libc/float.yo +66 -44
  102. package/std/libc/limits.yo +42 -33
  103. package/std/libc/math.yo +53 -82
  104. package/std/libc/signal.yo +72 -47
  105. package/std/libc/stdatomic.yo +217 -188
  106. package/std/libc/stdint.yo +5 -29
  107. package/std/libc/stdio.yo +5 -29
  108. package/std/libc/stdlib.yo +32 -39
  109. package/std/libc/string.yo +5 -23
  110. package/std/libc/sys/stat.yo +58 -56
  111. package/std/libc/time.yo +5 -19
  112. package/std/libc/unistd.yo +5 -20
  113. package/std/libc/wctype.yo +6 -9
  114. package/std/libc/windows.yo +26 -30
  115. package/std/log.yo +41 -55
  116. package/std/net/addr.yo +102 -97
  117. package/std/net/dns.yo +27 -28
  118. package/std/net/errors.yo +50 -49
  119. package/std/net/tcp.yo +113 -124
  120. package/std/net/udp.yo +55 -66
  121. package/std/os/env.yo +35 -33
  122. package/std/os/signal.yo +15 -25
  123. package/std/path.yo +276 -311
  124. package/std/prelude.yo +6316 -4333
  125. package/std/process/command.yo +87 -103
  126. package/std/process/index.yo +12 -31
  127. package/std/regex/compiler.yo +196 -95
  128. package/std/regex/flags.yo +58 -39
  129. package/std/regex/index.yo +157 -173
  130. package/std/regex/match.yo +20 -31
  131. package/std/regex/node.yo +134 -152
  132. package/std/regex/parser.yo +283 -259
  133. package/std/regex/unicode.yo +172 -202
  134. package/std/regex/vm.yo +155 -171
  135. package/std/string/index.yo +5 -7
  136. package/std/string/rune.yo +45 -55
  137. package/std/string/string.yo +937 -964
  138. package/std/string/string_builder.yo +94 -104
  139. package/std/string/unicode.yo +46 -64
  140. package/std/sync/channel.yo +72 -73
  141. package/std/sync/cond.yo +31 -36
  142. package/std/sync/mutex.yo +30 -32
  143. package/std/sync/once.yo +13 -16
  144. package/std/sync/rwlock.yo +26 -31
  145. package/std/sync/waitgroup.yo +20 -25
  146. package/std/sys/advise.yo +16 -24
  147. package/std/sys/bufio/buf_reader.yo +77 -93
  148. package/std/sys/bufio/buf_writer.yo +52 -65
  149. package/std/sys/clock.yo +4 -9
  150. package/std/sys/constants.yo +77 -61
  151. package/std/sys/copy.yo +4 -10
  152. package/std/sys/dir.yo +26 -43
  153. package/std/sys/dns.yo +41 -61
  154. package/std/sys/errors.yo +95 -103
  155. package/std/sys/events.yo +45 -57
  156. package/std/sys/externs.yo +319 -267
  157. package/std/sys/fallocate.yo +7 -11
  158. package/std/sys/fcntl.yo +14 -22
  159. package/std/sys/file.yo +26 -40
  160. package/std/sys/future.yo +5 -8
  161. package/std/sys/iov.yo +12 -25
  162. package/std/sys/lock.yo +12 -13
  163. package/std/sys/mmap.yo +38 -43
  164. package/std/sys/path.yo +3 -8
  165. package/std/sys/perm.yo +7 -21
  166. package/std/sys/pipe.yo +5 -12
  167. package/std/sys/process.yo +23 -29
  168. package/std/sys/seek.yo +10 -12
  169. package/std/sys/signal.yo +7 -13
  170. package/std/sys/signals.yo +52 -35
  171. package/std/sys/socket.yo +63 -58
  172. package/std/sys/socketpair.yo +3 -6
  173. package/std/sys/sockinfo.yo +11 -20
  174. package/std/sys/statfs.yo +11 -34
  175. package/std/sys/statx.yo +25 -52
  176. package/std/sys/sysinfo.yo +15 -20
  177. package/std/sys/tcp.yo +62 -92
  178. package/std/sys/temp.yo +5 -9
  179. package/std/sys/time.yo +5 -15
  180. package/std/sys/timer.yo +6 -11
  181. package/std/sys/tty.yo +10 -18
  182. package/std/sys/udp.yo +22 -39
  183. package/std/sys/umask.yo +3 -6
  184. package/std/sys/unix.yo +33 -52
  185. package/std/testing/bench.yo +49 -52
  186. package/std/thread.yo +10 -15
  187. package/std/time/datetime.yo +105 -89
  188. package/std/time/duration.yo +43 -56
  189. package/std/time/instant.yo +13 -18
  190. package/std/time/sleep.yo +5 -9
  191. package/std/url/index.yo +184 -209
  192. package/std/worker.yo +6 -10
  193. package/out/types/src/evaluator/calls/module-type.d.ts +0 -11
  194. package/out/types/src/evaluator/types/module.d.ts +0 -19
@@ -10,20 +10,15 @@
10
10
  //! m.set(String.from("a"), 1);
11
11
  //! // Iteration order: a, b
12
12
  //! ```
13
-
14
- { ArrayList } :: import "./array_list";
15
- open import "../string";
16
-
13
+ { ArrayList } :: import("./array_list");
14
+ open(import("../string"));
17
15
  /// Key-value pair entry stored in a BTreeMap.
18
16
  BTreeEntry :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
19
- struct(key: K, value: V)
17
+ struct(key : K, value : V)
20
18
  );
21
-
22
- export BTreeEntry;
23
-
19
+ export(BTreeEntry);
24
20
  // Internal result from binary search.
25
- _FindResult :: struct(idx: usize, found: bool);
26
-
21
+ _FindResult :: struct(idx : usize, found : bool);
27
22
  /// Sorted map maintaining entries in key order.
28
23
  /// Provides ordered iteration and O(log n) lookup via binary search. Insert is O(n).
29
24
  BTreeMap :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
@@ -31,74 +26,75 @@ BTreeMap :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
31
26
  _entries : ArrayList(BTreeEntry(K, V))
32
27
  )
33
28
  );
34
-
35
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
29
+ impl(
30
+ forall(K : Type, V : Type),
31
+ BTreeMap(K, V),
36
32
  // Create an empty map.
37
33
  new : (fn() -> Self)(
38
- Self(_entries: ArrayList(BTreeEntry(K, V)).new())
34
+ Self(_entries : ArrayList(BTreeEntry(K, V)).new())
39
35
  ),
40
-
41
36
  // Number of entries.
42
- len : (fn(self: Self) -> usize)(
37
+ len : (fn(self : Self) -> usize)(
43
38
  self._entries.len()
44
39
  ),
45
-
46
40
  // True if empty.
47
- is_empty : (fn(self: Self) -> bool)(
48
- (self._entries.len() == usize(0))
41
+ is_empty : (fn(self : Self) -> bool)(
42
+ self._entries.len() == usize(0)
49
43
  ),
50
-
51
44
  // Binary search: returns the index of the entry with key `k`,
52
45
  // or the insertion point if not found.
53
- _find : (fn(self: Self, k: K, where(K <: Ord(K))) -> _FindResult)({
46
+ _find : (fn(self : Self, k : K, where(K <: Ord(K))) -> _FindResult)({
54
47
  lo := usize(0);
55
48
  hi := self._entries.len();
56
- while (lo < hi), {
49
+ while(lo < hi, {
57
50
  mid := (lo + ((hi - lo) / usize(2)));
58
51
  entry_key := self._entries.get(mid).unwrap().key;
59
52
  cond(
60
- (entry_key < k) => { lo = (mid + usize(1)); },
61
- (entry_key > k) => { hi = mid; },
62
- true => { return _FindResult(mid, true); }
53
+ (entry_key < k) => {
54
+ lo = (mid + usize(1));
55
+ },
56
+ (entry_key > k) => {
57
+ hi = mid;
58
+ },
59
+ true => {
60
+ return(_FindResult(mid, true));
61
+ }
63
62
  );
64
- };
63
+ });
65
64
  _FindResult(lo, false)
66
65
  }),
67
-
68
66
  // Retrieve the value associated with key `k`.
69
- get : (fn(self: Self, k: K, where(K <: Ord(K))) -> ?V)({
67
+ get : (fn(self : Self, k : K, where(K <: Ord(K))) -> ?(V))({
70
68
  r := self._find(k);
71
69
  cond(
72
- r.found => .Some(self._entries.get(r.idx).unwrap().value),
73
- true => .None
70
+ r.found =>.Some(self._entries.get(r.idx).unwrap().value),
71
+ true =>.None
74
72
  )
75
73
  }),
76
-
77
74
  // Insert or update the value for key `k`.
78
75
  // For new keys: append at end then shift-left to correct sorted position.
79
- set : (fn(self: Self, k: K, v: V, where(K <: Ord(K))) -> unit)({
76
+ set : (fn(self : Self, k : K, v : V, where(K <: Ord(K))) -> unit)({
80
77
  r := self._find(k);
81
78
  cond(
82
79
  r.found => {
83
80
  entry := self._entries.get(r.idx).unwrap();
84
- &(self._entries(r.idx)).* = BTreeEntry(K, V)(key: entry.key, value: v);
81
+ &(self._entries(r.idx)).* = BTreeEntry(K, V)(key : entry.key, value : v);
85
82
  },
86
83
  true => {
87
84
  // Append new entry then bubble left to sorted position
88
- self._entries.push(BTreeEntry(K, V)(key: k, value: v));
85
+ self._entries.push(BTreeEntry(K, V)(key : k, value : v));
89
86
  pos := (self._entries.len() - usize(1));
90
- while (pos > r.idx), (pos = (pos - usize(1))), {
87
+ while(pos > r.idx, pos = (pos - usize(1)), {
91
88
  curr := self._entries.get(pos).unwrap();
92
- prev := self._entries.get((pos - usize(1))).unwrap();
89
+ prev := self._entries.get(pos - usize(1)).unwrap();
93
90
  &(self._entries(pos)).* = prev;
94
- &(self._entries((pos - usize(1)))).* = curr;
95
- };
91
+ &(self._entries(pos - usize(1))).* = curr;
92
+ });
96
93
  }
97
94
  );
98
95
  }),
99
-
100
96
  // Remove the entry with key `k`. Returns the old value, or .None.
101
- remove : (fn(self: Self, k: K, where(K <: Ord(K))) -> ?V)({
97
+ remove : (fn(self : Self, k : K, where(K <: Ord(K))) -> ?(V))({
102
98
  r := self._find(k);
103
99
  cond(
104
100
  r.found => {
@@ -106,155 +102,170 @@ impl(forall(K : Type, V : Type), BTreeMap(K, V),
106
102
  self._entries.remove(r.idx);
107
103
  .Some(v)
108
104
  },
109
- true => .None
105
+ true =>.None
110
106
  )
111
107
  }),
112
-
113
108
  // Return the entry with the smallest key, or .None.
114
- min : (fn(self: Self) -> ?BTreeEntry(K, V))(
109
+ min : (fn(self : Self) -> ?(BTreeEntry(K, V)))(
115
110
  cond(
116
- (self._entries.len() == usize(0)) => .None,
117
- true => .Some(self._entries.get(usize(0)).unwrap())
111
+ (self._entries.len() == usize(0)) =>.None,
112
+ true =>.Some(self._entries.get(usize(0)).unwrap())
118
113
  )
119
114
  ),
120
-
121
115
  // Return the entry with the largest key, or .None.
122
- max : (fn(self: Self) -> ?BTreeEntry(K, V))(
116
+ max : (fn(self : Self) -> ?(BTreeEntry(K, V)))(
123
117
  cond(
124
- (self._entries.len() == usize(0)) => .None,
125
- true => .Some(self._entries.get((self._entries.len() - usize(1))).unwrap())
118
+ (self._entries.len() == usize(0)) =>.None,
119
+ true =>.Some(self._entries.get(self._entries.len() - usize(1)).unwrap())
126
120
  )
127
121
  )
128
122
  );
129
-
130
123
  /**
131
- * Value iterator for BTreeMap - yields BTreeEntry(K, V) in sorted key order
132
- */
124
+ * Value iterator for BTreeMap - yields BTreeEntry(K, V) in sorted key order
125
+ */
133
126
  BTreeMapIter :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
134
127
  struct(
135
128
  _entries : ArrayList(BTreeEntry(K, V)),
136
- _index : usize
129
+ _index : usize
137
130
  )
138
131
  );
139
-
140
- impl(forall(K : Type, V : Type), BTreeMapIter(K, V), Iterator(
141
- Item : BTreeEntry(K, V),
142
- next : (fn(self : *(Self)) -> Option(BTreeEntry(K, V)))(
143
- cond(
144
- (self._index >= self._entries.len()) => .None,
145
- true => {
146
- entry := self._entries.get(self._index).unwrap();
147
- self._index = (self._index + usize(1));
148
- .Some(entry)
149
- }
132
+ impl(
133
+ forall(K : Type, V : Type),
134
+ BTreeMapIter(K, V),
135
+ Iterator(
136
+ Item : BTreeEntry(K, V),
137
+ next : (fn(self : *(Self)) -> Option(BTreeEntry(K, V)))(
138
+ cond(
139
+ (self._index >= self._entries.len()) =>.None,
140
+ true => {
141
+ entry := self._entries.get(self._index).unwrap();
142
+ self._index = (self._index + usize(1));
143
+ .Some(entry)
144
+ }
145
+ )
150
146
  )
151
147
  )
152
- ));
153
-
154
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
148
+ );
149
+ impl(
150
+ forall(K : Type, V : Type),
151
+ BTreeMap(K, V),
155
152
  into_iter : (fn(self : Self) -> BTreeMapIter(K, V))(
156
- BTreeMapIter(K, V)(_entries: self._entries, _index: usize(0))
153
+ BTreeMapIter(K, V)(_entries : self._entries, _index : usize(0))
157
154
  )
158
155
  );
159
-
160
156
  /**
161
- * Pointer iterator for BTreeMap - yields pointers to BTreeEntry(K, V) in sorted key order
162
- */
157
+ * Pointer iterator for BTreeMap - yields pointers to BTreeEntry(K, V) in sorted key order
158
+ */
163
159
  BTreeMapIterPtr :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
164
160
  struct(
165
161
  _entries : ArrayList(BTreeEntry(K, V)),
166
- _index : usize
162
+ _index : usize
167
163
  )
168
164
  );
169
-
170
- impl(forall(K : Type, V : Type), BTreeMapIterPtr(K, V), Iterator(
171
- Item : *(BTreeEntry(K, V)),
172
- next : (fn(self : *(Self)) -> Option(*(BTreeEntry(K, V))))(
173
- cond(
174
- (self._index >= self._entries.len()) => .None,
175
- true =>
176
- match(self._entries._ptr,
177
- .Some(ptr) => {
178
- element_ptr := (ptr &+ self._index);
179
- self._index = (self._index + usize(1));
180
- .Some(element_ptr)
181
- },
182
- .None => .None
183
- )
165
+ impl(
166
+ forall(K : Type, V : Type),
167
+ BTreeMapIterPtr(K, V),
168
+ Iterator(
169
+ Item : *(BTreeEntry(K, V)),
170
+ next : (fn(self : *(Self)) -> Option(*(BTreeEntry(K, V))))(
171
+ cond(
172
+ (self._index >= self._entries.len()) =>.None,
173
+ true =>
174
+ match(
175
+ self._entries._ptr,
176
+ .Some(ptr) => {
177
+ element_ptr := (ptr &+ self._index);
178
+ self._index = (self._index + usize(1));
179
+ .Some(element_ptr)
180
+ },
181
+ .None =>.None
182
+ )
183
+ )
184
184
  )
185
185
  )
186
- ));
187
-
188
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
186
+ );
187
+ impl(
188
+ forall(K : Type, V : Type),
189
+ BTreeMap(K, V),
189
190
  iter : (fn(self : *(Self)) -> BTreeMapIterPtr(K, V))(
190
- BTreeMapIterPtr(K, V)(_entries: self.*._entries, _index: usize(0))
191
+ BTreeMapIterPtr(K, V)(_entries : self.*._entries, _index : usize(0))
191
192
  )
192
193
  );
193
-
194
194
  /**
195
- * Keys iterator - wraps BTreeMapIter and yields only keys in sorted order
196
- */
195
+ * Keys iterator - wraps BTreeMapIter and yields only keys in sorted order
196
+ */
197
197
  BTreeMapKeys :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
198
198
  struct(
199
199
  _inner : BTreeMapIter(K, V)
200
200
  )
201
201
  );
202
-
203
- impl(forall(K : Type, V : Type), BTreeMapKeys(K, V), Iterator(
204
- Item : K,
205
- next : (fn(self : *(Self)) -> Option(K))(
206
- match(self._inner.next(),
207
- .None => .None,
208
- .Some(entry) => .Some(entry.key)
202
+ impl(
203
+ forall(K : Type, V : Type),
204
+ BTreeMapKeys(K, V),
205
+ Iterator(
206
+ Item : K,
207
+ next : (fn(self : *(Self)) -> Option(K))(
208
+ match(
209
+ self._inner.next(),
210
+ .None =>.None,
211
+ .Some(entry) =>.Some(entry.key)
212
+ )
209
213
  )
210
214
  )
211
- ));
212
-
213
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
215
+ );
216
+ impl(
217
+ forall(K : Type, V : Type),
218
+ BTreeMap(K, V),
214
219
  keys : (fn(self : Self) -> BTreeMapKeys(K, V))(
215
- BTreeMapKeys(K, V)(_inner: BTreeMapIter(K, V)(_entries: self._entries, _index: usize(0)))
220
+ BTreeMapKeys(K, V)(_inner : BTreeMapIter(K, V)(_entries : self._entries, _index : usize(0)))
216
221
  )
217
222
  );
218
-
219
223
  /**
220
- * Values iterator - wraps BTreeMapIter and yields only values in sorted key order
221
- */
224
+ * Values iterator - wraps BTreeMapIter and yields only values in sorted key order
225
+ */
222
226
  BTreeMapValues :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
223
227
  struct(
224
228
  _inner : BTreeMapIter(K, V)
225
229
  )
226
230
  );
227
-
228
- impl(forall(K : Type, V : Type), BTreeMapValues(K, V), Iterator(
229
- Item : V,
230
- next : (fn(self : *(Self)) -> Option(V))(
231
- match(self._inner.next(),
232
- .None => .None,
233
- .Some(entry) => .Some(entry.value)
231
+ impl(
232
+ forall(K : Type, V : Type),
233
+ BTreeMapValues(K, V),
234
+ Iterator(
235
+ Item : V,
236
+ next : (fn(self : *(Self)) -> Option(V))(
237
+ match(
238
+ self._inner.next(),
239
+ .None =>.None,
240
+ .Some(entry) =>.Some(entry.value)
241
+ )
234
242
  )
235
243
  )
236
- ));
237
-
238
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
244
+ );
245
+ impl(
246
+ forall(K : Type, V : Type),
247
+ BTreeMap(K, V),
239
248
  values : (fn(self : Self) -> BTreeMapValues(K, V))(
240
- BTreeMapValues(K, V)(_inner: BTreeMapIter(K, V)(_entries: self._entries, _index: usize(0)))
249
+ BTreeMapValues(K, V)(_inner : BTreeMapIter(K, V)(_entries : self._entries, _index : usize(0)))
241
250
  )
242
251
  );
243
-
244
- impl(forall(K : Type, V : Type), BTreeMap(K, V), Index(K)(
245
- Output : V,
246
- index : (fn(self: *(Self), idx: K, where(K <: Ord(K))) -> *(Self.Output))({
247
- r := self.*._find(idx);
248
- assert(r.found, "BTreeMap: key not found");
249
- entry_ptr := &(self.*._entries(r.idx));
250
- &(entry_ptr.*.value)
251
- })
252
- ));
253
-
254
- export
252
+ impl(
253
+ forall(K : Type, V : Type),
254
+ BTreeMap(K, V),
255
+ Index(K)(
256
+ Output : V,
257
+ index : (fn(self : *(Self), idx : K, where(K <: Ord(K))) -> *(Self.Output))({
258
+ r := self.*._find(idx);
259
+ assert(r.found, "BTreeMap: key not found");
260
+ entry_ptr := &(self.*._entries(r.idx));
261
+ &(entry_ptr.*.value)
262
+ })
263
+ )
264
+ );
265
+ export(
255
266
  BTreeMap,
256
267
  BTreeMapIter,
257
268
  BTreeMapIterPtr,
258
269
  BTreeMapKeys,
259
270
  BTreeMapValues
260
- ;
271
+ );