code-ruby 3.1.2 → 4.0.0
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/code +97 -20
- data/lib/code/concerns/shared.rb +331 -15
- data/lib/code/format.rb +15 -1
- data/lib/code/network.rb +87 -0
- data/lib/code/node/call.rb +79 -2
- data/lib/code/node/call_argument.rb +14 -0
- data/lib/code/node/code.rb +5 -4
- data/lib/code/node/function_parameter.rb +7 -4
- data/lib/code/node/list.rb +29 -1
- data/lib/code/object/base_64.rb +132 -6
- data/lib/code/object/boolean.rb +60 -0
- data/lib/code/object/class.rb +138 -2
- data/lib/code/object/code.rb +111 -3
- data/lib/code/object/context.rb +57 -1
- data/lib/code/object/cryptography.rb +63 -0
- data/lib/code/object/date.rb +13339 -462
- data/lib/code/object/decimal.rb +1725 -0
- data/lib/code/object/dictionary.rb +1790 -11
- data/lib/code/object/duration.rb +28 -0
- data/lib/code/object/function.rb +261 -23
- data/lib/code/object/global.rb +534 -1
- data/lib/code/object/html.rb +179 -7
- data/lib/code/object/http.rb +244 -14
- data/lib/code/object/ics.rb +75 -13
- data/lib/code/object/identifier_list.rb +17 -2
- data/lib/code/object/integer.rb +1937 -2
- data/lib/code/object/json.rb +75 -1
- data/lib/code/object/list.rb +3383 -10
- data/lib/code/object/nothing.rb +53 -0
- data/lib/code/object/number.rb +110 -0
- data/lib/code/object/parameter.rb +140 -0
- data/lib/code/object/range.rb +576 -14
- data/lib/code/object/smtp.rb +95 -12
- data/lib/code/object/string.rb +944 -3
- data/lib/code/object/super.rb +10 -1
- data/lib/code/object/time.rb +13358 -498
- data/lib/code/object/url.rb +65 -0
- data/lib/code/object.rb +543 -0
- data/lib/code/parser.rb +161 -24
- data/lib/code-ruby.rb +3 -0
- data/lib/code.rb +30 -3
- metadata +135 -84
- data/.github/dependabot.yml +0 -15
- data/.github/workflows/ci.yml +0 -38
- data/.gitignore +0 -30
- data/.node-version +0 -1
- data/.npm-version +0 -1
- data/.prettierignore +0 -2
- data/.rspec +0 -1
- data/.rubocop.yml +0 -140
- data/.ruby-version +0 -1
- data/.tool-versions +0 -3
- data/AGENTS.md +0 -43
- data/Gemfile +0 -22
- data/Gemfile.lock +0 -292
- data/Rakefile +0 -5
- data/bin/bundle +0 -123
- data/bin/bundle-audit +0 -31
- data/bin/bundler-audit +0 -31
- data/bin/dorian +0 -31
- data/bin/rspec +0 -31
- data/bin/rubocop +0 -31
- data/bin/test +0 -5
- data/code-ruby.gemspec +0 -34
- data/docs/precedence.txt +0 -36
- data/package-lock.json +0 -14
- data/package.json +0 -7
- data/spec/bin/code_spec.rb +0 -48
- data/spec/code/format_spec.rb +0 -153
- data/spec/code/node/call_spec.rb +0 -11
- data/spec/code/object/boolean_spec.rb +0 -18
- data/spec/code/object/cryptography_spec.rb +0 -25
- data/spec/code/object/decimal_spec.rb +0 -50
- data/spec/code/object/dictionary_spec.rb +0 -98
- data/spec/code/object/function_spec.rb +0 -268
- data/spec/code/object/http_spec.rb +0 -33
- data/spec/code/object/ics_spec.rb +0 -50
- data/spec/code/object/integer_spec.rb +0 -42
- data/spec/code/object/list_spec.rb +0 -22
- data/spec/code/object/nothing_spec.rb +0 -14
- data/spec/code/object/range_spec.rb +0 -23
- data/spec/code/object/string_spec.rb +0 -26
- data/spec/code/parser/boolean_spec.rb +0 -11
- data/spec/code/parser/chained_call_spec.rb +0 -16
- data/spec/code/parser/dictionary_spec.rb +0 -18
- data/spec/code/parser/function_spec.rb +0 -16
- data/spec/code/parser/group_spec.rb +0 -11
- data/spec/code/parser/if_modifier_spec.rb +0 -18
- data/spec/code/parser/list_spec.rb +0 -17
- data/spec/code/parser/number_spec.rb +0 -11
- data/spec/code/parser/string_spec.rb +0 -20
- data/spec/code/parser_spec.rb +0 -52
- data/spec/code/type_spec.rb +0 -21
- data/spec/code_spec.rb +0 -717
- data/spec/spec_helper.rb +0 -21
- data/spec/zeitwerk/loader_spec.rb +0 -7
|
@@ -3,6 +3,1470 @@
|
|
|
3
3
|
class Code
|
|
4
4
|
class Object
|
|
5
5
|
class Dictionary < ::Code::Object
|
|
6
|
+
CLASS_DOCUMENTATION = {
|
|
7
|
+
name: "Dictionary",
|
|
8
|
+
description: "stores keyed values and provides lookup, merge, and enumerable operations.",
|
|
9
|
+
examples: [
|
|
10
|
+
"{ a: 1 }",
|
|
11
|
+
"Dictionary.from_entries([[:a, 1]])",
|
|
12
|
+
"{ a: 1 }.fetch(:a)"
|
|
13
|
+
]
|
|
14
|
+
}.freeze
|
|
15
|
+
CLASS_FUNCTIONS = {
|
|
16
|
+
"entries" => {
|
|
17
|
+
name: "entries",
|
|
18
|
+
description: "converts a dictionary to a list of key-value entries.",
|
|
19
|
+
examples: [
|
|
20
|
+
"Dictionary.entries({ a: 1 })",
|
|
21
|
+
"Dictionary.entries({ a: 1, b: 2 })",
|
|
22
|
+
"Dictionary.entries({})"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"from_entries" => {
|
|
26
|
+
name: "from_entries",
|
|
27
|
+
description: "builds a dictionary from key-value entries.",
|
|
28
|
+
examples: [
|
|
29
|
+
"Dictionary.from_entries([[:a, 1]])",
|
|
30
|
+
"Dictionary.from_entries([[:a, 1], [:b, 2]])",
|
|
31
|
+
"Dictionary.from_entries([])"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"assign" => {
|
|
35
|
+
name: "assign",
|
|
36
|
+
description: "merges one or more dictionaries into a new dictionary.",
|
|
37
|
+
examples: [
|
|
38
|
+
"Dictionary.assign({ a: 1 })",
|
|
39
|
+
"Dictionary.assign({ a: 1 }, { b: 2 })",
|
|
40
|
+
"Dictionary.assign({ a: 1 }, { a: 2 })"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"has_own?" => {
|
|
44
|
+
name: "has_own?",
|
|
45
|
+
description: "returns whether a dictionary contains a key.",
|
|
46
|
+
examples: [
|
|
47
|
+
"Dictionary.has_own?({ a: 1 }, :a)",
|
|
48
|
+
"Dictionary.has_own?({ a: 1 }, :b)",
|
|
49
|
+
"Dictionary.has_own?({}, :a)"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}.freeze
|
|
53
|
+
INSTANCE_FUNCTIONS = {
|
|
54
|
+
"[]" => {
|
|
55
|
+
name: "[]",
|
|
56
|
+
description: "returns the value for a key, otherwise nothing.",
|
|
57
|
+
examples: ["{ a: 1 }[:a]", "{ a: 1 }[:b]", "{ a: 1, b: 2 }[:b]"]
|
|
58
|
+
},
|
|
59
|
+
"at" => {
|
|
60
|
+
name: "at",
|
|
61
|
+
description: "alias for get.",
|
|
62
|
+
examples: ["{ a: 1 }.at(:a)", "{ a: 1 }.at(:b)", "{ a: 1, b: 2 }.at(:b)"]
|
|
63
|
+
},
|
|
64
|
+
"get" => {
|
|
65
|
+
name: "get",
|
|
66
|
+
description: "returns the value for a key, otherwise nothing.",
|
|
67
|
+
examples: ["{ a: 1 }.get(:a)", "{ a: 1 }.get(:b)", "{ a: 1, b: 2 }.get(:b)"]
|
|
68
|
+
},
|
|
69
|
+
"any?" => {
|
|
70
|
+
name: "any?",
|
|
71
|
+
description: "returns whether any entry exists, has a class value, or matches a function.",
|
|
72
|
+
examples: [
|
|
73
|
+
"{ a: 1 }.any?",
|
|
74
|
+
"{}.any?",
|
|
75
|
+
"{ a: 1 }.any?((key, value) => { value == 1 })"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"clear" => {
|
|
79
|
+
name: "clear",
|
|
80
|
+
description: "removes every entry from the dictionary and returns it.",
|
|
81
|
+
examples: ["{ a: 1 }.clear", "{ a: 1, b: 2 }.clear", "{}.clear"]
|
|
82
|
+
},
|
|
83
|
+
"compact" => {
|
|
84
|
+
name: "compact",
|
|
85
|
+
description: "returns a dictionary without nothing values or matching values.",
|
|
86
|
+
examples: [
|
|
87
|
+
"{ a: 1, b: nothing }.compact",
|
|
88
|
+
"{ a: 1, b: :x }.compact(String)",
|
|
89
|
+
"{ a: 1, b: 2 }.compact((value) => { value > 1 })"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"compact!" => {
|
|
93
|
+
name: "compact!",
|
|
94
|
+
description: "removes nothing values or matching values from the dictionary.",
|
|
95
|
+
examples: [
|
|
96
|
+
"{ a: 1, b: nothing }.compact!",
|
|
97
|
+
"{ a: 1, b: :x }.compact!(String)",
|
|
98
|
+
"{ a: 1, b: 2 }.compact!((value) => { value > 1 })"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"delete" => {
|
|
102
|
+
name: "delete",
|
|
103
|
+
description: "removes entries by key and returns their values.",
|
|
104
|
+
examples: [
|
|
105
|
+
"{ a: 1 }.delete(:a)",
|
|
106
|
+
"{ a: 1 }.delete(:b)",
|
|
107
|
+
"{ a: 1, b: 2 }.delete(:a, :b)"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"delete_if" => {
|
|
111
|
+
name: "delete_if",
|
|
112
|
+
description: "removes entries when a function returns truthy.",
|
|
113
|
+
examples: [
|
|
114
|
+
"{ a: 1, b: 2 }.delete_if((key, value) => { value > 1 })",
|
|
115
|
+
"{ a: 1 }.delete_if((key) => { key == :a })",
|
|
116
|
+
"{ a: 1, b: :x }.delete_if(String)"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"delete_unless" => {
|
|
120
|
+
name: "delete_unless",
|
|
121
|
+
description: "removes entries unless a function returns truthy.",
|
|
122
|
+
examples: [
|
|
123
|
+
"{ a: 1, b: 2 }.delete_unless((key, value) => { value > 1 })",
|
|
124
|
+
"{ a: 1 }.delete_unless((key) => { key == :a })",
|
|
125
|
+
"{ a: 1, b: :x }.delete_unless(String)"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"dig" => {
|
|
129
|
+
name: "dig",
|
|
130
|
+
description: "returns a nested value by following keys.",
|
|
131
|
+
examples: [
|
|
132
|
+
"{ a: { b: 1 } }.dig(:a, :b)",
|
|
133
|
+
"{ a: [1] }.dig(:a, 0)",
|
|
134
|
+
"{ a: 1 }.dig(:missing)"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"each" => {
|
|
138
|
+
name: "each",
|
|
139
|
+
description: "calls a function for each key-value pair and returns the dictionary.",
|
|
140
|
+
examples: [
|
|
141
|
+
"{ a: 1 }.each((key, value) => { value })",
|
|
142
|
+
"{ a: 1 }.each((key, value, index) => { index })",
|
|
143
|
+
"{ a: 1 }.each((key, value, index, dictionary) => { dictionary })"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
"each_key" => {
|
|
147
|
+
name: "each_key",
|
|
148
|
+
description: "calls a function for each key and returns the dictionary.",
|
|
149
|
+
examples: [
|
|
150
|
+
"{ a: 1 }.each_key((key) => { key })",
|
|
151
|
+
"{ a: 1, b: 2 }.each_key((key, index) => { index })",
|
|
152
|
+
"{}.each_key((key) => { key })"
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"each_value" => {
|
|
156
|
+
name: "each_value",
|
|
157
|
+
description: "calls a function for each value and returns the dictionary.",
|
|
158
|
+
examples: [
|
|
159
|
+
"{ a: 1 }.each_value((value) => { value })",
|
|
160
|
+
"{ a: 1, b: 2 }.each_value((value, index) => { index })",
|
|
161
|
+
"{}.each_value((value) => { value })"
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"each_pair" => {
|
|
165
|
+
name: "each_pair",
|
|
166
|
+
description: "calls a function for each key-value pair and returns the dictionary.",
|
|
167
|
+
examples: [
|
|
168
|
+
"{ a: 1 }.each_pair((key, value) => { value })",
|
|
169
|
+
"{ a: 1, b: 2 }.each_pair((key, value, index) => { index })",
|
|
170
|
+
"{}.each_pair((key, value) => { value })"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"empty?" => {
|
|
174
|
+
name: "empty?",
|
|
175
|
+
description: "returns whether the dictionary has no entries.",
|
|
176
|
+
examples: ["{}.empty?", "{ a: 1 }.empty?", "{ a: nothing }.empty?"]
|
|
177
|
+
},
|
|
178
|
+
"except" => {
|
|
179
|
+
name: "except",
|
|
180
|
+
description: "returns a dictionary without the given keys.",
|
|
181
|
+
examples: [
|
|
182
|
+
"{ a: 1, b: 2 }.except(:a)",
|
|
183
|
+
"{ a: 1, b: 2 }.except(:a, :b)",
|
|
184
|
+
"{ a: 1 }.except(:missing)"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"fetch" => {
|
|
188
|
+
name: "fetch",
|
|
189
|
+
description: "returns values by key, default function, or nothing.",
|
|
190
|
+
examples: [
|
|
191
|
+
"{ a: 1 }.fetch(:a)",
|
|
192
|
+
"{ a: 1 }.fetch(:b, () => { 2 })",
|
|
193
|
+
"{ a: 1 }.fetch(:missing)"
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"fetch_values" => {
|
|
197
|
+
name: "fetch_values",
|
|
198
|
+
description: "returns values for the given keys.",
|
|
199
|
+
examples: [
|
|
200
|
+
"{ a: 1, b: 2 }.fetch_values(:a)",
|
|
201
|
+
"{ a: 1, b: 2 }.fetch_values(:a, :b)",
|
|
202
|
+
"{ a: 1, b: 2 }.fetch_values(:b)"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
"flatten" => {
|
|
206
|
+
name: "flatten",
|
|
207
|
+
description: "returns a flattened list of dictionary keys and values.",
|
|
208
|
+
examples: ["{ a: 1 }.flatten", "{ a: { b: 1 } }.flatten", "{ a: 1 }.flatten(1)"]
|
|
209
|
+
},
|
|
210
|
+
"has_key?" => {
|
|
211
|
+
name: "has_key?",
|
|
212
|
+
description: "returns whether the dictionary contains a key.",
|
|
213
|
+
examples: ["{ a: 1 }.has_key?(:a)", "{ a: 1 }.has_key?(:b)", "{}.has_key?(:a)"]
|
|
214
|
+
},
|
|
215
|
+
"key?" => {
|
|
216
|
+
name: "key?",
|
|
217
|
+
description: "alias for has_key?.",
|
|
218
|
+
examples: ["{ a: 1 }.key?(:a)", "{ a: 1 }.key?(:b)", "{}.key?(:a)"]
|
|
219
|
+
},
|
|
220
|
+
"include?" => {
|
|
221
|
+
name: "include?",
|
|
222
|
+
description: "alias for has_key?.",
|
|
223
|
+
examples: ["{ a: 1 }.include?(:a)", "{ a: 1 }.include?(:b)", "{}.include?(:a)"]
|
|
224
|
+
},
|
|
225
|
+
"member?" => {
|
|
226
|
+
name: "member?",
|
|
227
|
+
description: "alias for has_key?.",
|
|
228
|
+
examples: ["{ a: 1 }.member?(:a)", "{ a: 1 }.member?(:b)", "{}.member?(:a)"]
|
|
229
|
+
},
|
|
230
|
+
"has_own?" => {
|
|
231
|
+
name: "has_own?",
|
|
232
|
+
description: "returns whether the dictionary contains a key.",
|
|
233
|
+
examples: ["{ a: 1 }.has_own?(:a)", "{ a: 1 }.has_own?(:b)", "{}.has_own?(:a)"]
|
|
234
|
+
},
|
|
235
|
+
"has_value?" => {
|
|
236
|
+
name: "has_value?",
|
|
237
|
+
description: "returns whether the dictionary has a value.",
|
|
238
|
+
examples: [
|
|
239
|
+
"{ a: 1 }.has_value?(1)",
|
|
240
|
+
"{ a: 1 }.has_value?(2)",
|
|
241
|
+
"{}.has_value?(1)"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"value?" => {
|
|
245
|
+
name: "value?",
|
|
246
|
+
description: "alias for has_value?.",
|
|
247
|
+
examples: ["{ a: 1 }.value?(1)", "{ a: 1 }.value?(2)", "{}.value?(1)"]
|
|
248
|
+
},
|
|
249
|
+
"invert" => {
|
|
250
|
+
name: "invert",
|
|
251
|
+
description: "returns a dictionary with keys and values swapped.",
|
|
252
|
+
examples: ["{ a: 1 }.invert", "{ a: 1, b: 2 }.invert", "{}.invert"]
|
|
253
|
+
},
|
|
254
|
+
"keep_if" => {
|
|
255
|
+
name: "keep_if",
|
|
256
|
+
description: "keeps entries when a function returns truthy.",
|
|
257
|
+
examples: [
|
|
258
|
+
"{ a: 1, b: 2 }.keep_if((key, value) => { value > 1 })",
|
|
259
|
+
"{ a: 1 }.keep_if((key) => { key == :a })",
|
|
260
|
+
"{ a: 1, b: :x }.keep_if(String)"
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
"keep_unless" => {
|
|
264
|
+
name: "keep_unless",
|
|
265
|
+
description: "keeps entries unless a function returns truthy.",
|
|
266
|
+
examples: [
|
|
267
|
+
"{ a: 1, b: 2 }.keep_unless((key, value) => { value > 1 })",
|
|
268
|
+
"{ a: 1 }.keep_unless((key) => { key == :a })",
|
|
269
|
+
"{ a: 1, b: :x }.keep_unless(String)"
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
"key" => {
|
|
273
|
+
name: "key",
|
|
274
|
+
description: "returns the first key for a value, or a fallback result.",
|
|
275
|
+
examples: [
|
|
276
|
+
"{ a: 1 }.key(1)",
|
|
277
|
+
"{ a: 1, b: 2 }.key(2)",
|
|
278
|
+
"{ a: 1, b: 2 }.key(0, (value) => { :missing })"
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
"keys" => {
|
|
282
|
+
name: "keys",
|
|
283
|
+
description: "returns the dictionary keys.",
|
|
284
|
+
examples: ["{ a: 1 }.keys", "{ a: 1, b: 2 }.keys", "{}.keys"]
|
|
285
|
+
},
|
|
286
|
+
"map" => {
|
|
287
|
+
name: "map",
|
|
288
|
+
description: "returns a list by calling a function for each entry.",
|
|
289
|
+
examples: [
|
|
290
|
+
"{ a: 1 }.map((key, value) => { key })",
|
|
291
|
+
"{ a: 1 }.map((key, value) => { value })",
|
|
292
|
+
"{ a: 1 }.map((key, value, index) => { index })"
|
|
293
|
+
]
|
|
294
|
+
},
|
|
295
|
+
"merge" => {
|
|
296
|
+
name: "merge",
|
|
297
|
+
description: "returns a dictionary merged with other dictionaries.",
|
|
298
|
+
examples: [
|
|
299
|
+
"{ a: 1 }.merge({ b: 2 })",
|
|
300
|
+
"{ a: 1 }.merge({ a: 2 })",
|
|
301
|
+
"{ a: 1 }.merge({ a: 2 }, (key, left, right) => { left })"
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
"merge!" => {
|
|
305
|
+
name: "merge!",
|
|
306
|
+
description: "merges other dictionaries into the receiver.",
|
|
307
|
+
examples: [
|
|
308
|
+
"{ a: 1 }.merge!({ b: 2 })",
|
|
309
|
+
"{ a: 1 }.merge!({ a: 2 })",
|
|
310
|
+
"{ a: 1 }.merge!({ a: 2 }, (key, left, right) => { left })"
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
"update" => {
|
|
314
|
+
name: "update",
|
|
315
|
+
description: "alias for merge!.",
|
|
316
|
+
examples: [
|
|
317
|
+
"{ a: 1 }.update({ b: 2 })",
|
|
318
|
+
"{ a: 1 }.update({ a: 2 })",
|
|
319
|
+
"{ a: 1 }.update({ a: 2 }, (key, left, right) => { left })"
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
"replace" => {
|
|
323
|
+
name: "replace",
|
|
324
|
+
description: "replaces the dictionary contents with another dictionary.",
|
|
325
|
+
examples: [
|
|
326
|
+
"{ a: 1 }.replace({ b: 2 })",
|
|
327
|
+
"{ a: 1, b: 2 }.replace({})",
|
|
328
|
+
"{}.replace({ a: 1 })"
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
"store" => {
|
|
332
|
+
name: "store",
|
|
333
|
+
description: "sets a key to a value and returns the value.",
|
|
334
|
+
examples: [
|
|
335
|
+
"{ a: 1 }.store(:b, 2)",
|
|
336
|
+
"{}.store(:a, 1)",
|
|
337
|
+
"{ a: 1 }.store(:a, 2)"
|
|
338
|
+
]
|
|
339
|
+
},
|
|
340
|
+
"shift" => {
|
|
341
|
+
name: "shift",
|
|
342
|
+
description: "removes and returns the first key-value entry.",
|
|
343
|
+
examples: ["{ a: 1 }.shift", "{ a: 1, b: 2 }.shift", "{}.shift"]
|
|
344
|
+
},
|
|
345
|
+
"reject" => {
|
|
346
|
+
name: "reject",
|
|
347
|
+
description: "returns a dictionary without entries matching a function.",
|
|
348
|
+
examples: [
|
|
349
|
+
"{ a: 1, b: 2 }.reject((key, value) => { value > 1 })",
|
|
350
|
+
"{ a: 1 }.reject((key) => { key == :a })",
|
|
351
|
+
"{ a: 1, b: :x }.reject(String)"
|
|
352
|
+
]
|
|
353
|
+
},
|
|
354
|
+
"reject!" => {
|
|
355
|
+
name: "reject!",
|
|
356
|
+
description: "removes entries matching a function.",
|
|
357
|
+
examples: [
|
|
358
|
+
"{ a: 1, b: 2 }.reject!((key, value) => { value > 1 })",
|
|
359
|
+
"{ a: 1 }.reject!((key) => { key == :a })",
|
|
360
|
+
"{ a: 1, b: :x }.reject!(String)"
|
|
361
|
+
]
|
|
362
|
+
},
|
|
363
|
+
"select" => {
|
|
364
|
+
name: "select",
|
|
365
|
+
description: "returns a dictionary with entries matching a function.",
|
|
366
|
+
examples: [
|
|
367
|
+
"{ a: 1, b: 2 }.select((key, value) => { value > 1 })",
|
|
368
|
+
"{ a: 1 }.select((key) => { key == :a })",
|
|
369
|
+
"{ a: 1, b: :x }.select(String)"
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
"filter" => {
|
|
373
|
+
name: "filter",
|
|
374
|
+
description: "alias for select.",
|
|
375
|
+
examples: [
|
|
376
|
+
"{ a: 1, b: 2 }.filter((key, value) => { value > 1 })",
|
|
377
|
+
"{ a: 1 }.filter((key) => { key == :a })",
|
|
378
|
+
"{ a: 1, b: :x }.filter(String)"
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
"select!" => {
|
|
382
|
+
name: "select!",
|
|
383
|
+
description: "keeps entries matching a function.",
|
|
384
|
+
examples: [
|
|
385
|
+
"{ a: 1, b: 2 }.select!((key, value) => { value > 1 })",
|
|
386
|
+
"{ a: 1 }.select!((key) => { key == :a })",
|
|
387
|
+
"{ a: 1, b: :x }.select!(String)"
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
"filter!" => {
|
|
391
|
+
name: "filter!",
|
|
392
|
+
description: "alias for select!.",
|
|
393
|
+
examples: [
|
|
394
|
+
"{ a: 1, b: 2 }.filter!((key, value) => { value > 1 })",
|
|
395
|
+
"{ a: 1 }.filter!((key) => { key == :a })",
|
|
396
|
+
"{ a: 1, b: :x }.filter!(String)"
|
|
397
|
+
]
|
|
398
|
+
},
|
|
399
|
+
"set" => {
|
|
400
|
+
name: "set",
|
|
401
|
+
description: "sets a key to a value and returns the value.",
|
|
402
|
+
examples: ["{ a: 1 }.set(:b, 2)", "{}.set(:a, 1)", "{ a: 1 }.set(:a, 2)"]
|
|
403
|
+
},
|
|
404
|
+
"size" => {
|
|
405
|
+
name: "size",
|
|
406
|
+
description: "returns the number of entries.",
|
|
407
|
+
examples: ["{}.size", "{ a: 1 }.size", "{ a: 1, b: 2 }.size"]
|
|
408
|
+
},
|
|
409
|
+
"length" => {
|
|
410
|
+
name: "length",
|
|
411
|
+
description: "alias for size.",
|
|
412
|
+
examples: ["{}.length", "{ a: 1 }.length", "{ a: 1, b: 2 }.length"]
|
|
413
|
+
},
|
|
414
|
+
"slice" => {
|
|
415
|
+
name: "slice",
|
|
416
|
+
description: "returns a dictionary with only the given keys.",
|
|
417
|
+
examples: [
|
|
418
|
+
"{ a: 1, b: 2 }.slice(:a)",
|
|
419
|
+
"{ a: 1, b: 2 }.slice(:a, :b)",
|
|
420
|
+
"{ a: 1 }.slice(:missing)"
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
"to_list" => {
|
|
424
|
+
name: "to_list",
|
|
425
|
+
description: "returns key-value entries as a list.",
|
|
426
|
+
examples: ["{ a: 1 }.to_list", "{ a: 1, b: 2 }.to_list", "{}.to_list"]
|
|
427
|
+
},
|
|
428
|
+
"entries" => {
|
|
429
|
+
name: "entries",
|
|
430
|
+
description: "returns key-value entries as a list.",
|
|
431
|
+
examples: ["{ a: 1 }.entries", "{ a: 1, b: 2 }.entries", "{}.entries"]
|
|
432
|
+
},
|
|
433
|
+
"to_dictionary" => {
|
|
434
|
+
name: "to_dictionary",
|
|
435
|
+
description: "returns the dictionary.",
|
|
436
|
+
examples: [
|
|
437
|
+
"{ a: 1 }.to_dictionary",
|
|
438
|
+
"{ a: 1, b: 2 }.to_dictionary",
|
|
439
|
+
"{}.to_dictionary"
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
"to_context" => {
|
|
443
|
+
name: "to_context",
|
|
444
|
+
description: "converts the dictionary to a context.",
|
|
445
|
+
examples: ["{ a: 1 }.to_context", "{ a: 1, b: 2 }.to_context", "{}.to_context"]
|
|
446
|
+
},
|
|
447
|
+
"to_query" => {
|
|
448
|
+
name: "to_query",
|
|
449
|
+
description: "converts the dictionary to a query string.",
|
|
450
|
+
examples: [
|
|
451
|
+
"{ a: 1 }.to_query",
|
|
452
|
+
"{ a: 1, b: 2 }.to_query",
|
|
453
|
+
"{ q: :ruby }.to_query(:search)"
|
|
454
|
+
]
|
|
455
|
+
},
|
|
456
|
+
"transform_keys" => {
|
|
457
|
+
name: "transform_keys",
|
|
458
|
+
description: "returns a dictionary with keys transformed by a function.",
|
|
459
|
+
examples: [
|
|
460
|
+
"{ a: 1 }.transform_keys((key) => { key.to_string })",
|
|
461
|
+
"{ a: 1 }.transform_keys((key, value) => { value })",
|
|
462
|
+
"{ a: 1 }.transform_keys((key, value, index) => { index })"
|
|
463
|
+
]
|
|
464
|
+
},
|
|
465
|
+
"transform_keys!" => {
|
|
466
|
+
name: "transform_keys!",
|
|
467
|
+
description: "transforms keys in the receiver with a function.",
|
|
468
|
+
examples: [
|
|
469
|
+
"{ a: 1 }.transform_keys!((key) => { key.to_string })",
|
|
470
|
+
"{ a: 1 }.transform_keys!((key, value) => { value })",
|
|
471
|
+
"{ a: 1 }.transform_keys!((key, value, index) => { index })"
|
|
472
|
+
]
|
|
473
|
+
},
|
|
474
|
+
"transform_values" => {
|
|
475
|
+
name: "transform_values",
|
|
476
|
+
description: "returns a dictionary with values transformed by a key-value function.",
|
|
477
|
+
examples: [
|
|
478
|
+
"{ a: 1 }.transform_values((key, value) => { value + 1 })",
|
|
479
|
+
"{ a: 1 }.transform_values((key, value) => { key })",
|
|
480
|
+
"{ a: 1 }.transform_values((key, value, index) => { index })"
|
|
481
|
+
]
|
|
482
|
+
},
|
|
483
|
+
"transform_values!" => {
|
|
484
|
+
name: "transform_values!",
|
|
485
|
+
description: "transforms values in the receiver with a key-value function.",
|
|
486
|
+
examples: [
|
|
487
|
+
"{ a: 1 }.transform_values!((key, value) => { value + 1 })",
|
|
488
|
+
"{ a: 1 }.transform_values!((key, value) => { key })",
|
|
489
|
+
"{ a: 1 }.transform_values!((key, value, index) => { index })"
|
|
490
|
+
]
|
|
491
|
+
},
|
|
492
|
+
"values" => {
|
|
493
|
+
name: "values",
|
|
494
|
+
description: "returns all values, values for keys, or mapped values.",
|
|
495
|
+
examples: [
|
|
496
|
+
"{ a: 1, b: 2 }.values",
|
|
497
|
+
"{ a: 1, b: 2 }.values(:a)",
|
|
498
|
+
"{ a: 1, b: 2 }.values(:a, () => { 0 })"
|
|
499
|
+
]
|
|
500
|
+
},
|
|
501
|
+
"values_at" => {
|
|
502
|
+
name: "values_at",
|
|
503
|
+
description: "returns values for the given keys.",
|
|
504
|
+
examples: [
|
|
505
|
+
"{ a: 1, b: 2 }.values_at(:a)",
|
|
506
|
+
"{ a: 1, b: 2 }.values_at(:a, :b)",
|
|
507
|
+
"{ a: 1 }.values_at(:missing)"
|
|
508
|
+
]
|
|
509
|
+
},
|
|
510
|
+
"associate" => {
|
|
511
|
+
name: "associate",
|
|
512
|
+
description: "returns the key-value entry for a key, otherwise nothing.",
|
|
513
|
+
examples: [
|
|
514
|
+
"{ a: 1 }.associate(:a)",
|
|
515
|
+
"{ a: 1, b: 2 }.associate(:b)",
|
|
516
|
+
"{}.associate(:a)"
|
|
517
|
+
]
|
|
518
|
+
},
|
|
519
|
+
"right_associate" => {
|
|
520
|
+
name: "right_associate",
|
|
521
|
+
description: "returns the first key-value entry for a value, otherwise nothing.",
|
|
522
|
+
examples: [
|
|
523
|
+
"{ a: 1 }.right_associate(1)",
|
|
524
|
+
"{ a: 1, b: 2 }.right_associate(2)",
|
|
525
|
+
"{}.right_associate(1)"
|
|
526
|
+
]
|
|
527
|
+
},
|
|
528
|
+
"deep_duplicate" => {
|
|
529
|
+
name: "deep_duplicate",
|
|
530
|
+
description: "returns a deep duplicate of the dictionary.",
|
|
531
|
+
examples: [
|
|
532
|
+
"{ a: 1 }.deep_duplicate",
|
|
533
|
+
"{ a: [1] }.deep_duplicate",
|
|
534
|
+
"{}.deep_duplicate"
|
|
535
|
+
]
|
|
536
|
+
},
|
|
537
|
+
"many?" => {
|
|
538
|
+
name: "many?",
|
|
539
|
+
description: "returns whether the dictionary has more than one entry.",
|
|
540
|
+
examples: ["{ a: 1, b: 2 }.many?", "{ a: 1 }.many?", "{}.many?"]
|
|
541
|
+
},
|
|
542
|
+
"positive?" => {
|
|
543
|
+
name: "positive?",
|
|
544
|
+
description: "returns whether the dictionary size is positive.",
|
|
545
|
+
examples: ["{ a: 1 }.positive?", "{}.positive?", "{ a: 1, b: 2 }.positive?"]
|
|
546
|
+
},
|
|
547
|
+
"negative?" => {
|
|
548
|
+
name: "negative?",
|
|
549
|
+
description: "returns whether the dictionary size is negative.",
|
|
550
|
+
examples: ["{}.negative?", "{ a: 1 }.negative?", "{ a: 1, b: 2 }.negative?"]
|
|
551
|
+
},
|
|
552
|
+
"zero?" => {
|
|
553
|
+
name: "zero?",
|
|
554
|
+
description: "returns whether the dictionary size is zero.",
|
|
555
|
+
examples: [
|
|
556
|
+
"{}.zero?",
|
|
557
|
+
"{ a: 1 }.zero?",
|
|
558
|
+
"{ a: 1, b: 2 }.zero?"
|
|
559
|
+
]
|
|
560
|
+
},
|
|
561
|
+
"one?" => {
|
|
562
|
+
name: "one?",
|
|
563
|
+
description: "returns whether the dictionary size is one.",
|
|
564
|
+
examples: [
|
|
565
|
+
"Dictionary.from_entries((1..1).to_list.map((x) => { [x, x] })).one?",
|
|
566
|
+
"Dictionary.from_entries((1..2).to_list.map((x) => { [x, x] })).one?",
|
|
567
|
+
"{}.one?"
|
|
568
|
+
]
|
|
569
|
+
},
|
|
570
|
+
"two?" => {
|
|
571
|
+
name: "two?",
|
|
572
|
+
description: "returns whether the dictionary size is two.",
|
|
573
|
+
examples: [
|
|
574
|
+
"Dictionary.from_entries((1..2).to_list.map((x) => { [x, x] })).two?",
|
|
575
|
+
"Dictionary.from_entries((1..3).to_list.map((x) => { [x, x] })).two?",
|
|
576
|
+
"{}.two?"
|
|
577
|
+
]
|
|
578
|
+
},
|
|
579
|
+
"three?" => {
|
|
580
|
+
name: "three?",
|
|
581
|
+
description: "returns whether the dictionary size is three.",
|
|
582
|
+
examples: [
|
|
583
|
+
"Dictionary.from_entries((1..3).to_list.map((x) => { [x, x] })).three?",
|
|
584
|
+
"Dictionary.from_entries((1..4).to_list.map((x) => { [x, x] })).three?",
|
|
585
|
+
"{}.three?"
|
|
586
|
+
]
|
|
587
|
+
},
|
|
588
|
+
"four?" => {
|
|
589
|
+
name: "four?",
|
|
590
|
+
description: "returns whether the dictionary size is four.",
|
|
591
|
+
examples: [
|
|
592
|
+
"Dictionary.from_entries((1..4).to_list.map((x) => { [x, x] })).four?",
|
|
593
|
+
"Dictionary.from_entries((1..5).to_list.map((x) => { [x, x] })).four?",
|
|
594
|
+
"{}.four?"
|
|
595
|
+
]
|
|
596
|
+
},
|
|
597
|
+
"five?" => {
|
|
598
|
+
name: "five?",
|
|
599
|
+
description: "returns whether the dictionary size is five.",
|
|
600
|
+
examples: [
|
|
601
|
+
"Dictionary.from_entries((1..5).to_list.map((x) => { [x, x] })).five?",
|
|
602
|
+
"Dictionary.from_entries((1..6).to_list.map((x) => { [x, x] })).five?",
|
|
603
|
+
"{}.five?"
|
|
604
|
+
]
|
|
605
|
+
},
|
|
606
|
+
"six?" => {
|
|
607
|
+
name: "six?",
|
|
608
|
+
description: "returns whether the dictionary size is six.",
|
|
609
|
+
examples: [
|
|
610
|
+
"Dictionary.from_entries((1..6).to_list.map((x) => { [x, x] })).six?",
|
|
611
|
+
"Dictionary.from_entries((1..7).to_list.map((x) => { [x, x] })).six?",
|
|
612
|
+
"{}.six?"
|
|
613
|
+
]
|
|
614
|
+
},
|
|
615
|
+
"seven?" => {
|
|
616
|
+
name: "seven?",
|
|
617
|
+
description: "returns whether the dictionary size is seven.",
|
|
618
|
+
examples: [
|
|
619
|
+
"Dictionary.from_entries((1..7).to_list.map((x) => { [x, x] })).seven?",
|
|
620
|
+
"Dictionary.from_entries((1..8).to_list.map((x) => { [x, x] })).seven?",
|
|
621
|
+
"{}.seven?"
|
|
622
|
+
]
|
|
623
|
+
},
|
|
624
|
+
"eight?" => {
|
|
625
|
+
name: "eight?",
|
|
626
|
+
description: "returns whether the dictionary size is eight.",
|
|
627
|
+
examples: [
|
|
628
|
+
"Dictionary.from_entries((1..8).to_list.map((x) => { [x, x] })).eight?",
|
|
629
|
+
"Dictionary.from_entries((1..9).to_list.map((x) => { [x, x] })).eight?",
|
|
630
|
+
"{}.eight?"
|
|
631
|
+
]
|
|
632
|
+
},
|
|
633
|
+
"nine?" => {
|
|
634
|
+
name: "nine?",
|
|
635
|
+
description: "returns whether the dictionary size is nine.",
|
|
636
|
+
examples: [
|
|
637
|
+
"Dictionary.from_entries((1..9).to_list.map((x) => { [x, x] })).nine?",
|
|
638
|
+
"Dictionary.from_entries((1..10).to_list.map((x) => { [x, x] })).nine?",
|
|
639
|
+
"{}.nine?"
|
|
640
|
+
]
|
|
641
|
+
},
|
|
642
|
+
"ten?" => {
|
|
643
|
+
name: "ten?",
|
|
644
|
+
description: "returns whether the dictionary size is ten.",
|
|
645
|
+
examples: [
|
|
646
|
+
"Dictionary.from_entries((1..10).to_list.map((x) => { [x, x] })).ten?",
|
|
647
|
+
"Dictionary.from_entries((1..11).to_list.map((x) => { [x, x] })).ten?",
|
|
648
|
+
"{}.ten?"
|
|
649
|
+
]
|
|
650
|
+
},
|
|
651
|
+
"eleven?" => {
|
|
652
|
+
name: "eleven?",
|
|
653
|
+
description: "returns whether the dictionary size is eleven.",
|
|
654
|
+
examples: [
|
|
655
|
+
"Dictionary.from_entries((1..11).to_list.map((x) => { [x, x] })).eleven?",
|
|
656
|
+
"Dictionary.from_entries((1..12).to_list.map((x) => { [x, x] })).eleven?",
|
|
657
|
+
"{}.eleven?"
|
|
658
|
+
]
|
|
659
|
+
},
|
|
660
|
+
"twelve?" => {
|
|
661
|
+
name: "twelve?",
|
|
662
|
+
description: "returns whether the dictionary size is twelve.",
|
|
663
|
+
examples: [
|
|
664
|
+
"Dictionary.from_entries((1..12).to_list.map((x) => { [x, x] })).twelve?",
|
|
665
|
+
"Dictionary.from_entries((1..13).to_list.map((x) => { [x, x] })).twelve?",
|
|
666
|
+
"{}.twelve?"
|
|
667
|
+
]
|
|
668
|
+
},
|
|
669
|
+
"thirteen?" => {
|
|
670
|
+
name: "thirteen?",
|
|
671
|
+
description: "returns whether the dictionary size is thirteen.",
|
|
672
|
+
examples: [
|
|
673
|
+
"Dictionary.from_entries((1..13).to_list.map((x) => { [x, x] })).thirteen?",
|
|
674
|
+
"Dictionary.from_entries((1..14).to_list.map((x) => { [x, x] })).thirteen?",
|
|
675
|
+
"{}.thirteen?"
|
|
676
|
+
]
|
|
677
|
+
},
|
|
678
|
+
"fourteen?" => {
|
|
679
|
+
name: "fourteen?",
|
|
680
|
+
description: "returns whether the dictionary size is fourteen.",
|
|
681
|
+
examples: [
|
|
682
|
+
"Dictionary.from_entries((1..14).to_list.map((x) => { [x, x] })).fourteen?",
|
|
683
|
+
"Dictionary.from_entries((1..15).to_list.map((x) => { [x, x] })).fourteen?",
|
|
684
|
+
"{}.fourteen?"
|
|
685
|
+
]
|
|
686
|
+
},
|
|
687
|
+
"fifteen?" => {
|
|
688
|
+
name: "fifteen?",
|
|
689
|
+
description: "returns whether the dictionary size is fifteen.",
|
|
690
|
+
examples: [
|
|
691
|
+
"Dictionary.from_entries((1..15).to_list.map((x) => { [x, x] })).fifteen?",
|
|
692
|
+
"Dictionary.from_entries((1..16).to_list.map((x) => { [x, x] })).fifteen?",
|
|
693
|
+
"{}.fifteen?"
|
|
694
|
+
]
|
|
695
|
+
},
|
|
696
|
+
"sixteen?" => {
|
|
697
|
+
name: "sixteen?",
|
|
698
|
+
description: "returns whether the dictionary size is sixteen.",
|
|
699
|
+
examples: [
|
|
700
|
+
"Dictionary.from_entries((1..16).to_list.map((x) => { [x, x] })).sixteen?",
|
|
701
|
+
"Dictionary.from_entries((1..17).to_list.map((x) => { [x, x] })).sixteen?",
|
|
702
|
+
"{}.sixteen?"
|
|
703
|
+
]
|
|
704
|
+
},
|
|
705
|
+
"seventeen?" => {
|
|
706
|
+
name: "seventeen?",
|
|
707
|
+
description: "returns whether the dictionary size is seventeen.",
|
|
708
|
+
examples: [
|
|
709
|
+
"Dictionary.from_entries((1..17).to_list.map((x) => { [x, x] })).seventeen?",
|
|
710
|
+
"Dictionary.from_entries((1..18).to_list.map((x) => { [x, x] })).seventeen?",
|
|
711
|
+
"{}.seventeen?"
|
|
712
|
+
]
|
|
713
|
+
},
|
|
714
|
+
"eighteen?" => {
|
|
715
|
+
name: "eighteen?",
|
|
716
|
+
description: "returns whether the dictionary size is eighteen.",
|
|
717
|
+
examples: [
|
|
718
|
+
"Dictionary.from_entries((1..18).to_list.map((x) => { [x, x] })).eighteen?",
|
|
719
|
+
"Dictionary.from_entries((1..19).to_list.map((x) => { [x, x] })).eighteen?",
|
|
720
|
+
"{}.eighteen?"
|
|
721
|
+
]
|
|
722
|
+
},
|
|
723
|
+
"nineteen?" => {
|
|
724
|
+
name: "nineteen?",
|
|
725
|
+
description: "returns whether the dictionary size is nineteen.",
|
|
726
|
+
examples: [
|
|
727
|
+
"Dictionary.from_entries((1..19).to_list.map((x) => { [x, x] })).nineteen?",
|
|
728
|
+
"Dictionary.from_entries((1..20).to_list.map((x) => { [x, x] })).nineteen?",
|
|
729
|
+
"{}.nineteen?"
|
|
730
|
+
]
|
|
731
|
+
},
|
|
732
|
+
"twenty?" => {
|
|
733
|
+
name: "twenty?",
|
|
734
|
+
description: "returns whether the dictionary size is twenty.",
|
|
735
|
+
examples: [
|
|
736
|
+
"Dictionary.from_entries((1..20).to_list.map((x) => { [x, x] })).twenty?",
|
|
737
|
+
"Dictionary.from_entries((1..21).to_list.map((x) => { [x, x] })).twenty?",
|
|
738
|
+
"{}.twenty?"
|
|
739
|
+
]
|
|
740
|
+
},
|
|
741
|
+
"twenty_one?" => {
|
|
742
|
+
name: "twenty_one?",
|
|
743
|
+
description: "returns whether the dictionary size is twenty one.",
|
|
744
|
+
examples: [
|
|
745
|
+
"Dictionary.from_entries((1..21).to_list.map((x) => { [x, x] })).twenty_one?",
|
|
746
|
+
"Dictionary.from_entries((1..22).to_list.map((x) => { [x, x] })).twenty_one?",
|
|
747
|
+
"{}.twenty_one?"
|
|
748
|
+
]
|
|
749
|
+
},
|
|
750
|
+
"twenty_two?" => {
|
|
751
|
+
name: "twenty_two?",
|
|
752
|
+
description: "returns whether the dictionary size is twenty two.",
|
|
753
|
+
examples: [
|
|
754
|
+
"Dictionary.from_entries((1..22).to_list.map((x) => { [x, x] })).twenty_two?",
|
|
755
|
+
"Dictionary.from_entries((1..23).to_list.map((x) => { [x, x] })).twenty_two?",
|
|
756
|
+
"{}.twenty_two?"
|
|
757
|
+
]
|
|
758
|
+
},
|
|
759
|
+
"twenty_three?" => {
|
|
760
|
+
name: "twenty_three?",
|
|
761
|
+
description: "returns whether the dictionary size is twenty three.",
|
|
762
|
+
examples: [
|
|
763
|
+
"Dictionary.from_entries((1..23).to_list.map((x) => { [x, x] })).twenty_three?",
|
|
764
|
+
"Dictionary.from_entries((1..24).to_list.map((x) => { [x, x] })).twenty_three?",
|
|
765
|
+
"{}.twenty_three?"
|
|
766
|
+
]
|
|
767
|
+
},
|
|
768
|
+
"twenty_four?" => {
|
|
769
|
+
name: "twenty_four?",
|
|
770
|
+
description: "returns whether the dictionary size is twenty four.",
|
|
771
|
+
examples: [
|
|
772
|
+
"Dictionary.from_entries((1..24).to_list.map((x) => { [x, x] })).twenty_four?",
|
|
773
|
+
"Dictionary.from_entries((1..25).to_list.map((x) => { [x, x] })).twenty_four?",
|
|
774
|
+
"{}.twenty_four?"
|
|
775
|
+
]
|
|
776
|
+
},
|
|
777
|
+
"twenty_five?" => {
|
|
778
|
+
name: "twenty_five?",
|
|
779
|
+
description: "returns whether the dictionary size is twenty five.",
|
|
780
|
+
examples: [
|
|
781
|
+
"Dictionary.from_entries((1..25).to_list.map((x) => { [x, x] })).twenty_five?",
|
|
782
|
+
"Dictionary.from_entries((1..26).to_list.map((x) => { [x, x] })).twenty_five?",
|
|
783
|
+
"{}.twenty_five?"
|
|
784
|
+
]
|
|
785
|
+
},
|
|
786
|
+
"twenty_six?" => {
|
|
787
|
+
name: "twenty_six?",
|
|
788
|
+
description: "returns whether the dictionary size is twenty six.",
|
|
789
|
+
examples: [
|
|
790
|
+
"Dictionary.from_entries((1..26).to_list.map((x) => { [x, x] })).twenty_six?",
|
|
791
|
+
"Dictionary.from_entries((1..27).to_list.map((x) => { [x, x] })).twenty_six?",
|
|
792
|
+
"{}.twenty_six?"
|
|
793
|
+
]
|
|
794
|
+
},
|
|
795
|
+
"twenty_seven?" => {
|
|
796
|
+
name: "twenty_seven?",
|
|
797
|
+
description: "returns whether the dictionary size is twenty seven.",
|
|
798
|
+
examples: [
|
|
799
|
+
"Dictionary.from_entries((1..27).to_list.map((x) => { [x, x] })).twenty_seven?",
|
|
800
|
+
"Dictionary.from_entries((1..28).to_list.map((x) => { [x, x] })).twenty_seven?",
|
|
801
|
+
"{}.twenty_seven?"
|
|
802
|
+
]
|
|
803
|
+
},
|
|
804
|
+
"twenty_eight?" => {
|
|
805
|
+
name: "twenty_eight?",
|
|
806
|
+
description: "returns whether the dictionary size is twenty eight.",
|
|
807
|
+
examples: [
|
|
808
|
+
"Dictionary.from_entries((1..28).to_list.map((x) => { [x, x] })).twenty_eight?",
|
|
809
|
+
"Dictionary.from_entries((1..29).to_list.map((x) => { [x, x] })).twenty_eight?",
|
|
810
|
+
"{}.twenty_eight?"
|
|
811
|
+
]
|
|
812
|
+
},
|
|
813
|
+
"twenty_nine?" => {
|
|
814
|
+
name: "twenty_nine?",
|
|
815
|
+
description: "returns whether the dictionary size is twenty nine.",
|
|
816
|
+
examples: [
|
|
817
|
+
"Dictionary.from_entries((1..29).to_list.map((x) => { [x, x] })).twenty_nine?",
|
|
818
|
+
"Dictionary.from_entries((1..30).to_list.map((x) => { [x, x] })).twenty_nine?",
|
|
819
|
+
"{}.twenty_nine?"
|
|
820
|
+
]
|
|
821
|
+
},
|
|
822
|
+
"thirty?" => {
|
|
823
|
+
name: "thirty?",
|
|
824
|
+
description: "returns whether the dictionary size is thirty.",
|
|
825
|
+
examples: [
|
|
826
|
+
"Dictionary.from_entries((1..30).to_list.map((x) => { [x, x] })).thirty?",
|
|
827
|
+
"Dictionary.from_entries((1..31).to_list.map((x) => { [x, x] })).thirty?",
|
|
828
|
+
"{}.thirty?"
|
|
829
|
+
]
|
|
830
|
+
},
|
|
831
|
+
"thirty_one?" => {
|
|
832
|
+
name: "thirty_one?",
|
|
833
|
+
description: "returns whether the dictionary size is thirty one.",
|
|
834
|
+
examples: [
|
|
835
|
+
"Dictionary.from_entries((1..31).to_list.map((x) => { [x, x] })).thirty_one?",
|
|
836
|
+
"Dictionary.from_entries((1..32).to_list.map((x) => { [x, x] })).thirty_one?",
|
|
837
|
+
"{}.thirty_one?"
|
|
838
|
+
]
|
|
839
|
+
},
|
|
840
|
+
"thirty_two?" => {
|
|
841
|
+
name: "thirty_two?",
|
|
842
|
+
description: "returns whether the dictionary size is thirty two.",
|
|
843
|
+
examples: [
|
|
844
|
+
"Dictionary.from_entries((1..32).to_list.map((x) => { [x, x] })).thirty_two?",
|
|
845
|
+
"Dictionary.from_entries((1..33).to_list.map((x) => { [x, x] })).thirty_two?",
|
|
846
|
+
"{}.thirty_two?"
|
|
847
|
+
]
|
|
848
|
+
},
|
|
849
|
+
"thirty_three?" => {
|
|
850
|
+
name: "thirty_three?",
|
|
851
|
+
description: "returns whether the dictionary size is thirty three.",
|
|
852
|
+
examples: [
|
|
853
|
+
"Dictionary.from_entries((1..33).to_list.map((x) => { [x, x] })).thirty_three?",
|
|
854
|
+
"Dictionary.from_entries((1..34).to_list.map((x) => { [x, x] })).thirty_three?",
|
|
855
|
+
"{}.thirty_three?"
|
|
856
|
+
]
|
|
857
|
+
},
|
|
858
|
+
"thirty_four?" => {
|
|
859
|
+
name: "thirty_four?",
|
|
860
|
+
description: "returns whether the dictionary size is thirty four.",
|
|
861
|
+
examples: [
|
|
862
|
+
"Dictionary.from_entries((1..34).to_list.map((x) => { [x, x] })).thirty_four?",
|
|
863
|
+
"Dictionary.from_entries((1..35).to_list.map((x) => { [x, x] })).thirty_four?",
|
|
864
|
+
"{}.thirty_four?"
|
|
865
|
+
]
|
|
866
|
+
},
|
|
867
|
+
"thirty_five?" => {
|
|
868
|
+
name: "thirty_five?",
|
|
869
|
+
description: "returns whether the dictionary size is thirty five.",
|
|
870
|
+
examples: [
|
|
871
|
+
"Dictionary.from_entries((1..35).to_list.map((x) => { [x, x] })).thirty_five?",
|
|
872
|
+
"Dictionary.from_entries((1..36).to_list.map((x) => { [x, x] })).thirty_five?",
|
|
873
|
+
"{}.thirty_five?"
|
|
874
|
+
]
|
|
875
|
+
},
|
|
876
|
+
"thirty_six?" => {
|
|
877
|
+
name: "thirty_six?",
|
|
878
|
+
description: "returns whether the dictionary size is thirty six.",
|
|
879
|
+
examples: [
|
|
880
|
+
"Dictionary.from_entries((1..36).to_list.map((x) => { [x, x] })).thirty_six?",
|
|
881
|
+
"Dictionary.from_entries((1..37).to_list.map((x) => { [x, x] })).thirty_six?",
|
|
882
|
+
"{}.thirty_six?"
|
|
883
|
+
]
|
|
884
|
+
},
|
|
885
|
+
"thirty_seven?" => {
|
|
886
|
+
name: "thirty_seven?",
|
|
887
|
+
description: "returns whether the dictionary size is thirty seven.",
|
|
888
|
+
examples: [
|
|
889
|
+
"Dictionary.from_entries((1..37).to_list.map((x) => { [x, x] })).thirty_seven?",
|
|
890
|
+
"Dictionary.from_entries((1..38).to_list.map((x) => { [x, x] })).thirty_seven?",
|
|
891
|
+
"{}.thirty_seven?"
|
|
892
|
+
]
|
|
893
|
+
},
|
|
894
|
+
"thirty_eight?" => {
|
|
895
|
+
name: "thirty_eight?",
|
|
896
|
+
description: "returns whether the dictionary size is thirty eight.",
|
|
897
|
+
examples: [
|
|
898
|
+
"Dictionary.from_entries((1..38).to_list.map((x) => { [x, x] })).thirty_eight?",
|
|
899
|
+
"Dictionary.from_entries((1..39).to_list.map((x) => { [x, x] })).thirty_eight?",
|
|
900
|
+
"{}.thirty_eight?"
|
|
901
|
+
]
|
|
902
|
+
},
|
|
903
|
+
"thirty_nine?" => {
|
|
904
|
+
name: "thirty_nine?",
|
|
905
|
+
description: "returns whether the dictionary size is thirty nine.",
|
|
906
|
+
examples: [
|
|
907
|
+
"Dictionary.from_entries((1..39).to_list.map((x) => { [x, x] })).thirty_nine?",
|
|
908
|
+
"Dictionary.from_entries((1..40).to_list.map((x) => { [x, x] })).thirty_nine?",
|
|
909
|
+
"{}.thirty_nine?"
|
|
910
|
+
]
|
|
911
|
+
},
|
|
912
|
+
"forty?" => {
|
|
913
|
+
name: "forty?",
|
|
914
|
+
description: "returns whether the dictionary size is forty.",
|
|
915
|
+
examples: [
|
|
916
|
+
"Dictionary.from_entries((1..40).to_list.map((x) => { [x, x] })).forty?",
|
|
917
|
+
"Dictionary.from_entries((1..41).to_list.map((x) => { [x, x] })).forty?",
|
|
918
|
+
"{}.forty?"
|
|
919
|
+
]
|
|
920
|
+
},
|
|
921
|
+
"forty_one?" => {
|
|
922
|
+
name: "forty_one?",
|
|
923
|
+
description: "returns whether the dictionary size is forty one.",
|
|
924
|
+
examples: [
|
|
925
|
+
"Dictionary.from_entries((1..41).to_list.map((x) => { [x, x] })).forty_one?",
|
|
926
|
+
"Dictionary.from_entries((1..42).to_list.map((x) => { [x, x] })).forty_one?",
|
|
927
|
+
"{}.forty_one?"
|
|
928
|
+
]
|
|
929
|
+
},
|
|
930
|
+
"forty_two?" => {
|
|
931
|
+
name: "forty_two?",
|
|
932
|
+
description: "returns whether the dictionary size is forty two.",
|
|
933
|
+
examples: [
|
|
934
|
+
"Dictionary.from_entries((1..42).to_list.map((x) => { [x, x] })).forty_two?",
|
|
935
|
+
"Dictionary.from_entries((1..43).to_list.map((x) => { [x, x] })).forty_two?",
|
|
936
|
+
"{}.forty_two?"
|
|
937
|
+
]
|
|
938
|
+
},
|
|
939
|
+
"forty_three?" => {
|
|
940
|
+
name: "forty_three?",
|
|
941
|
+
description: "returns whether the dictionary size is forty three.",
|
|
942
|
+
examples: [
|
|
943
|
+
"Dictionary.from_entries((1..43).to_list.map((x) => { [x, x] })).forty_three?",
|
|
944
|
+
"Dictionary.from_entries((1..44).to_list.map((x) => { [x, x] })).forty_three?",
|
|
945
|
+
"{}.forty_three?"
|
|
946
|
+
]
|
|
947
|
+
},
|
|
948
|
+
"forty_four?" => {
|
|
949
|
+
name: "forty_four?",
|
|
950
|
+
description: "returns whether the dictionary size is forty four.",
|
|
951
|
+
examples: [
|
|
952
|
+
"Dictionary.from_entries((1..44).to_list.map((x) => { [x, x] })).forty_four?",
|
|
953
|
+
"Dictionary.from_entries((1..45).to_list.map((x) => { [x, x] })).forty_four?",
|
|
954
|
+
"{}.forty_four?"
|
|
955
|
+
]
|
|
956
|
+
},
|
|
957
|
+
"forty_five?" => {
|
|
958
|
+
name: "forty_five?",
|
|
959
|
+
description: "returns whether the dictionary size is forty five.",
|
|
960
|
+
examples: [
|
|
961
|
+
"Dictionary.from_entries((1..45).to_list.map((x) => { [x, x] })).forty_five?",
|
|
962
|
+
"Dictionary.from_entries((1..46).to_list.map((x) => { [x, x] })).forty_five?",
|
|
963
|
+
"{}.forty_five?"
|
|
964
|
+
]
|
|
965
|
+
},
|
|
966
|
+
"forty_six?" => {
|
|
967
|
+
name: "forty_six?",
|
|
968
|
+
description: "returns whether the dictionary size is forty six.",
|
|
969
|
+
examples: [
|
|
970
|
+
"Dictionary.from_entries((1..46).to_list.map((x) => { [x, x] })).forty_six?",
|
|
971
|
+
"Dictionary.from_entries((1..47).to_list.map((x) => { [x, x] })).forty_six?",
|
|
972
|
+
"{}.forty_six?"
|
|
973
|
+
]
|
|
974
|
+
},
|
|
975
|
+
"forty_seven?" => {
|
|
976
|
+
name: "forty_seven?",
|
|
977
|
+
description: "returns whether the dictionary size is forty seven.",
|
|
978
|
+
examples: [
|
|
979
|
+
"Dictionary.from_entries((1..47).to_list.map((x) => { [x, x] })).forty_seven?",
|
|
980
|
+
"Dictionary.from_entries((1..48).to_list.map((x) => { [x, x] })).forty_seven?",
|
|
981
|
+
"{}.forty_seven?"
|
|
982
|
+
]
|
|
983
|
+
},
|
|
984
|
+
"forty_eight?" => {
|
|
985
|
+
name: "forty_eight?",
|
|
986
|
+
description: "returns whether the dictionary size is forty eight.",
|
|
987
|
+
examples: [
|
|
988
|
+
"Dictionary.from_entries((1..48).to_list.map((x) => { [x, x] })).forty_eight?",
|
|
989
|
+
"Dictionary.from_entries((1..49).to_list.map((x) => { [x, x] })).forty_eight?",
|
|
990
|
+
"{}.forty_eight?"
|
|
991
|
+
]
|
|
992
|
+
},
|
|
993
|
+
"forty_nine?" => {
|
|
994
|
+
name: "forty_nine?",
|
|
995
|
+
description: "returns whether the dictionary size is forty nine.",
|
|
996
|
+
examples: [
|
|
997
|
+
"Dictionary.from_entries((1..49).to_list.map((x) => { [x, x] })).forty_nine?",
|
|
998
|
+
"Dictionary.from_entries((1..50).to_list.map((x) => { [x, x] })).forty_nine?",
|
|
999
|
+
"{}.forty_nine?"
|
|
1000
|
+
]
|
|
1001
|
+
},
|
|
1002
|
+
"fifty?" => {
|
|
1003
|
+
name: "fifty?",
|
|
1004
|
+
description: "returns whether the dictionary size is fifty.",
|
|
1005
|
+
examples: [
|
|
1006
|
+
"Dictionary.from_entries((1..50).to_list.map((x) => { [x, x] })).fifty?",
|
|
1007
|
+
"Dictionary.from_entries((1..51).to_list.map((x) => { [x, x] })).fifty?",
|
|
1008
|
+
"{}.fifty?"
|
|
1009
|
+
]
|
|
1010
|
+
},
|
|
1011
|
+
"fifty_one?" => {
|
|
1012
|
+
name: "fifty_one?",
|
|
1013
|
+
description: "returns whether the dictionary size is fifty one.",
|
|
1014
|
+
examples: [
|
|
1015
|
+
"Dictionary.from_entries((1..51).to_list.map((x) => { [x, x] })).fifty_one?",
|
|
1016
|
+
"Dictionary.from_entries((1..52).to_list.map((x) => { [x, x] })).fifty_one?",
|
|
1017
|
+
"{}.fifty_one?"
|
|
1018
|
+
]
|
|
1019
|
+
},
|
|
1020
|
+
"fifty_two?" => {
|
|
1021
|
+
name: "fifty_two?",
|
|
1022
|
+
description: "returns whether the dictionary size is fifty two.",
|
|
1023
|
+
examples: [
|
|
1024
|
+
"Dictionary.from_entries((1..52).to_list.map((x) => { [x, x] })).fifty_two?",
|
|
1025
|
+
"Dictionary.from_entries((1..53).to_list.map((x) => { [x, x] })).fifty_two?",
|
|
1026
|
+
"{}.fifty_two?"
|
|
1027
|
+
]
|
|
1028
|
+
},
|
|
1029
|
+
"fifty_three?" => {
|
|
1030
|
+
name: "fifty_three?",
|
|
1031
|
+
description: "returns whether the dictionary size is fifty three.",
|
|
1032
|
+
examples: [
|
|
1033
|
+
"Dictionary.from_entries((1..53).to_list.map((x) => { [x, x] })).fifty_three?",
|
|
1034
|
+
"Dictionary.from_entries((1..54).to_list.map((x) => { [x, x] })).fifty_three?",
|
|
1035
|
+
"{}.fifty_three?"
|
|
1036
|
+
]
|
|
1037
|
+
},
|
|
1038
|
+
"fifty_four?" => {
|
|
1039
|
+
name: "fifty_four?",
|
|
1040
|
+
description: "returns whether the dictionary size is fifty four.",
|
|
1041
|
+
examples: [
|
|
1042
|
+
"Dictionary.from_entries((1..54).to_list.map((x) => { [x, x] })).fifty_four?",
|
|
1043
|
+
"Dictionary.from_entries((1..55).to_list.map((x) => { [x, x] })).fifty_four?",
|
|
1044
|
+
"{}.fifty_four?"
|
|
1045
|
+
]
|
|
1046
|
+
},
|
|
1047
|
+
"fifty_five?" => {
|
|
1048
|
+
name: "fifty_five?",
|
|
1049
|
+
description: "returns whether the dictionary size is fifty five.",
|
|
1050
|
+
examples: [
|
|
1051
|
+
"Dictionary.from_entries((1..55).to_list.map((x) => { [x, x] })).fifty_five?",
|
|
1052
|
+
"Dictionary.from_entries((1..56).to_list.map((x) => { [x, x] })).fifty_five?",
|
|
1053
|
+
"{}.fifty_five?"
|
|
1054
|
+
]
|
|
1055
|
+
},
|
|
1056
|
+
"fifty_six?" => {
|
|
1057
|
+
name: "fifty_six?",
|
|
1058
|
+
description: "returns whether the dictionary size is fifty six.",
|
|
1059
|
+
examples: [
|
|
1060
|
+
"Dictionary.from_entries((1..56).to_list.map((x) => { [x, x] })).fifty_six?",
|
|
1061
|
+
"Dictionary.from_entries((1..57).to_list.map((x) => { [x, x] })).fifty_six?",
|
|
1062
|
+
"{}.fifty_six?"
|
|
1063
|
+
]
|
|
1064
|
+
},
|
|
1065
|
+
"fifty_seven?" => {
|
|
1066
|
+
name: "fifty_seven?",
|
|
1067
|
+
description: "returns whether the dictionary size is fifty seven.",
|
|
1068
|
+
examples: [
|
|
1069
|
+
"Dictionary.from_entries((1..57).to_list.map((x) => { [x, x] })).fifty_seven?",
|
|
1070
|
+
"Dictionary.from_entries((1..58).to_list.map((x) => { [x, x] })).fifty_seven?",
|
|
1071
|
+
"{}.fifty_seven?"
|
|
1072
|
+
]
|
|
1073
|
+
},
|
|
1074
|
+
"fifty_eight?" => {
|
|
1075
|
+
name: "fifty_eight?",
|
|
1076
|
+
description: "returns whether the dictionary size is fifty eight.",
|
|
1077
|
+
examples: [
|
|
1078
|
+
"Dictionary.from_entries((1..58).to_list.map((x) => { [x, x] })).fifty_eight?",
|
|
1079
|
+
"Dictionary.from_entries((1..59).to_list.map((x) => { [x, x] })).fifty_eight?",
|
|
1080
|
+
"{}.fifty_eight?"
|
|
1081
|
+
]
|
|
1082
|
+
},
|
|
1083
|
+
"fifty_nine?" => {
|
|
1084
|
+
name: "fifty_nine?",
|
|
1085
|
+
description: "returns whether the dictionary size is fifty nine.",
|
|
1086
|
+
examples: [
|
|
1087
|
+
"Dictionary.from_entries((1..59).to_list.map((x) => { [x, x] })).fifty_nine?",
|
|
1088
|
+
"Dictionary.from_entries((1..60).to_list.map((x) => { [x, x] })).fifty_nine?",
|
|
1089
|
+
"{}.fifty_nine?"
|
|
1090
|
+
]
|
|
1091
|
+
},
|
|
1092
|
+
"sixty?" => {
|
|
1093
|
+
name: "sixty?",
|
|
1094
|
+
description: "returns whether the dictionary size is sixty.",
|
|
1095
|
+
examples: [
|
|
1096
|
+
"Dictionary.from_entries((1..60).to_list.map((x) => { [x, x] })).sixty?",
|
|
1097
|
+
"Dictionary.from_entries((1..61).to_list.map((x) => { [x, x] })).sixty?",
|
|
1098
|
+
"{}.sixty?"
|
|
1099
|
+
]
|
|
1100
|
+
},
|
|
1101
|
+
"sixty_one?" => {
|
|
1102
|
+
name: "sixty_one?",
|
|
1103
|
+
description: "returns whether the dictionary size is sixty one.",
|
|
1104
|
+
examples: [
|
|
1105
|
+
"Dictionary.from_entries((1..61).to_list.map((x) => { [x, x] })).sixty_one?",
|
|
1106
|
+
"Dictionary.from_entries((1..62).to_list.map((x) => { [x, x] })).sixty_one?",
|
|
1107
|
+
"{}.sixty_one?"
|
|
1108
|
+
]
|
|
1109
|
+
},
|
|
1110
|
+
"sixty_two?" => {
|
|
1111
|
+
name: "sixty_two?",
|
|
1112
|
+
description: "returns whether the dictionary size is sixty two.",
|
|
1113
|
+
examples: [
|
|
1114
|
+
"Dictionary.from_entries((1..62).to_list.map((x) => { [x, x] })).sixty_two?",
|
|
1115
|
+
"Dictionary.from_entries((1..63).to_list.map((x) => { [x, x] })).sixty_two?",
|
|
1116
|
+
"{}.sixty_two?"
|
|
1117
|
+
]
|
|
1118
|
+
},
|
|
1119
|
+
"sixty_three?" => {
|
|
1120
|
+
name: "sixty_three?",
|
|
1121
|
+
description: "returns whether the dictionary size is sixty three.",
|
|
1122
|
+
examples: [
|
|
1123
|
+
"Dictionary.from_entries((1..63).to_list.map((x) => { [x, x] })).sixty_three?",
|
|
1124
|
+
"Dictionary.from_entries((1..64).to_list.map((x) => { [x, x] })).sixty_three?",
|
|
1125
|
+
"{}.sixty_three?"
|
|
1126
|
+
]
|
|
1127
|
+
},
|
|
1128
|
+
"sixty_four?" => {
|
|
1129
|
+
name: "sixty_four?",
|
|
1130
|
+
description: "returns whether the dictionary size is sixty four.",
|
|
1131
|
+
examples: [
|
|
1132
|
+
"Dictionary.from_entries((1..64).to_list.map((x) => { [x, x] })).sixty_four?",
|
|
1133
|
+
"Dictionary.from_entries((1..65).to_list.map((x) => { [x, x] })).sixty_four?",
|
|
1134
|
+
"{}.sixty_four?"
|
|
1135
|
+
]
|
|
1136
|
+
},
|
|
1137
|
+
"sixty_five?" => {
|
|
1138
|
+
name: "sixty_five?",
|
|
1139
|
+
description: "returns whether the dictionary size is sixty five.",
|
|
1140
|
+
examples: [
|
|
1141
|
+
"Dictionary.from_entries((1..65).to_list.map((x) => { [x, x] })).sixty_five?",
|
|
1142
|
+
"Dictionary.from_entries((1..66).to_list.map((x) => { [x, x] })).sixty_five?",
|
|
1143
|
+
"{}.sixty_five?"
|
|
1144
|
+
]
|
|
1145
|
+
},
|
|
1146
|
+
"sixty_six?" => {
|
|
1147
|
+
name: "sixty_six?",
|
|
1148
|
+
description: "returns whether the dictionary size is sixty six.",
|
|
1149
|
+
examples: [
|
|
1150
|
+
"Dictionary.from_entries((1..66).to_list.map((x) => { [x, x] })).sixty_six?",
|
|
1151
|
+
"Dictionary.from_entries((1..67).to_list.map((x) => { [x, x] })).sixty_six?",
|
|
1152
|
+
"{}.sixty_six?"
|
|
1153
|
+
]
|
|
1154
|
+
},
|
|
1155
|
+
"sixty_seven?" => {
|
|
1156
|
+
name: "sixty_seven?",
|
|
1157
|
+
description: "returns whether the dictionary size is sixty seven.",
|
|
1158
|
+
examples: [
|
|
1159
|
+
"Dictionary.from_entries((1..67).to_list.map((x) => { [x, x] })).sixty_seven?",
|
|
1160
|
+
"Dictionary.from_entries((1..68).to_list.map((x) => { [x, x] })).sixty_seven?",
|
|
1161
|
+
"{}.sixty_seven?"
|
|
1162
|
+
]
|
|
1163
|
+
},
|
|
1164
|
+
"sixty_eight?" => {
|
|
1165
|
+
name: "sixty_eight?",
|
|
1166
|
+
description: "returns whether the dictionary size is sixty eight.",
|
|
1167
|
+
examples: [
|
|
1168
|
+
"Dictionary.from_entries((1..68).to_list.map((x) => { [x, x] })).sixty_eight?",
|
|
1169
|
+
"Dictionary.from_entries((1..69).to_list.map((x) => { [x, x] })).sixty_eight?",
|
|
1170
|
+
"{}.sixty_eight?"
|
|
1171
|
+
]
|
|
1172
|
+
},
|
|
1173
|
+
"sixty_nine?" => {
|
|
1174
|
+
name: "sixty_nine?",
|
|
1175
|
+
description: "returns whether the dictionary size is sixty nine.",
|
|
1176
|
+
examples: [
|
|
1177
|
+
"Dictionary.from_entries((1..69).to_list.map((x) => { [x, x] })).sixty_nine?",
|
|
1178
|
+
"Dictionary.from_entries((1..70).to_list.map((x) => { [x, x] })).sixty_nine?",
|
|
1179
|
+
"{}.sixty_nine?"
|
|
1180
|
+
]
|
|
1181
|
+
},
|
|
1182
|
+
"seventy?" => {
|
|
1183
|
+
name: "seventy?",
|
|
1184
|
+
description: "returns whether the dictionary size is seventy.",
|
|
1185
|
+
examples: [
|
|
1186
|
+
"Dictionary.from_entries((1..70).to_list.map((x) => { [x, x] })).seventy?",
|
|
1187
|
+
"Dictionary.from_entries((1..71).to_list.map((x) => { [x, x] })).seventy?",
|
|
1188
|
+
"{}.seventy?"
|
|
1189
|
+
]
|
|
1190
|
+
},
|
|
1191
|
+
"seventy_one?" => {
|
|
1192
|
+
name: "seventy_one?",
|
|
1193
|
+
description: "returns whether the dictionary size is seventy one.",
|
|
1194
|
+
examples: [
|
|
1195
|
+
"Dictionary.from_entries((1..71).to_list.map((x) => { [x, x] })).seventy_one?",
|
|
1196
|
+
"Dictionary.from_entries((1..72).to_list.map((x) => { [x, x] })).seventy_one?",
|
|
1197
|
+
"{}.seventy_one?"
|
|
1198
|
+
]
|
|
1199
|
+
},
|
|
1200
|
+
"seventy_two?" => {
|
|
1201
|
+
name: "seventy_two?",
|
|
1202
|
+
description: "returns whether the dictionary size is seventy two.",
|
|
1203
|
+
examples: [
|
|
1204
|
+
"Dictionary.from_entries((1..72).to_list.map((x) => { [x, x] })).seventy_two?",
|
|
1205
|
+
"Dictionary.from_entries((1..73).to_list.map((x) => { [x, x] })).seventy_two?",
|
|
1206
|
+
"{}.seventy_two?"
|
|
1207
|
+
]
|
|
1208
|
+
},
|
|
1209
|
+
"seventy_three?" => {
|
|
1210
|
+
name: "seventy_three?",
|
|
1211
|
+
description: "returns whether the dictionary size is seventy three.",
|
|
1212
|
+
examples: [
|
|
1213
|
+
"Dictionary.from_entries((1..73).to_list.map((x) => { [x, x] })).seventy_three?",
|
|
1214
|
+
"Dictionary.from_entries((1..74).to_list.map((x) => { [x, x] })).seventy_three?",
|
|
1215
|
+
"{}.seventy_three?"
|
|
1216
|
+
]
|
|
1217
|
+
},
|
|
1218
|
+
"seventy_four?" => {
|
|
1219
|
+
name: "seventy_four?",
|
|
1220
|
+
description: "returns whether the dictionary size is seventy four.",
|
|
1221
|
+
examples: [
|
|
1222
|
+
"Dictionary.from_entries((1..74).to_list.map((x) => { [x, x] })).seventy_four?",
|
|
1223
|
+
"Dictionary.from_entries((1..75).to_list.map((x) => { [x, x] })).seventy_four?",
|
|
1224
|
+
"{}.seventy_four?"
|
|
1225
|
+
]
|
|
1226
|
+
},
|
|
1227
|
+
"seventy_five?" => {
|
|
1228
|
+
name: "seventy_five?",
|
|
1229
|
+
description: "returns whether the dictionary size is seventy five.",
|
|
1230
|
+
examples: [
|
|
1231
|
+
"Dictionary.from_entries((1..75).to_list.map((x) => { [x, x] })).seventy_five?",
|
|
1232
|
+
"Dictionary.from_entries((1..76).to_list.map((x) => { [x, x] })).seventy_five?",
|
|
1233
|
+
"{}.seventy_five?"
|
|
1234
|
+
]
|
|
1235
|
+
},
|
|
1236
|
+
"seventy_six?" => {
|
|
1237
|
+
name: "seventy_six?",
|
|
1238
|
+
description: "returns whether the dictionary size is seventy six.",
|
|
1239
|
+
examples: [
|
|
1240
|
+
"Dictionary.from_entries((1..76).to_list.map((x) => { [x, x] })).seventy_six?",
|
|
1241
|
+
"Dictionary.from_entries((1..77).to_list.map((x) => { [x, x] })).seventy_six?",
|
|
1242
|
+
"{}.seventy_six?"
|
|
1243
|
+
]
|
|
1244
|
+
},
|
|
1245
|
+
"seventy_seven?" => {
|
|
1246
|
+
name: "seventy_seven?",
|
|
1247
|
+
description: "returns whether the dictionary size is seventy seven.",
|
|
1248
|
+
examples: [
|
|
1249
|
+
"Dictionary.from_entries((1..77).to_list.map((x) => { [x, x] })).seventy_seven?",
|
|
1250
|
+
"Dictionary.from_entries((1..78).to_list.map((x) => { [x, x] })).seventy_seven?",
|
|
1251
|
+
"{}.seventy_seven?"
|
|
1252
|
+
]
|
|
1253
|
+
},
|
|
1254
|
+
"seventy_eight?" => {
|
|
1255
|
+
name: "seventy_eight?",
|
|
1256
|
+
description: "returns whether the dictionary size is seventy eight.",
|
|
1257
|
+
examples: [
|
|
1258
|
+
"Dictionary.from_entries((1..78).to_list.map((x) => { [x, x] })).seventy_eight?",
|
|
1259
|
+
"Dictionary.from_entries((1..79).to_list.map((x) => { [x, x] })).seventy_eight?",
|
|
1260
|
+
"{}.seventy_eight?"
|
|
1261
|
+
]
|
|
1262
|
+
},
|
|
1263
|
+
"seventy_nine?" => {
|
|
1264
|
+
name: "seventy_nine?",
|
|
1265
|
+
description: "returns whether the dictionary size is seventy nine.",
|
|
1266
|
+
examples: [
|
|
1267
|
+
"Dictionary.from_entries((1..79).to_list.map((x) => { [x, x] })).seventy_nine?",
|
|
1268
|
+
"Dictionary.from_entries((1..80).to_list.map((x) => { [x, x] })).seventy_nine?",
|
|
1269
|
+
"{}.seventy_nine?"
|
|
1270
|
+
]
|
|
1271
|
+
},
|
|
1272
|
+
"eighty?" => {
|
|
1273
|
+
name: "eighty?",
|
|
1274
|
+
description: "returns whether the dictionary size is eighty.",
|
|
1275
|
+
examples: [
|
|
1276
|
+
"Dictionary.from_entries((1..80).to_list.map((x) => { [x, x] })).eighty?",
|
|
1277
|
+
"Dictionary.from_entries((1..81).to_list.map((x) => { [x, x] })).eighty?",
|
|
1278
|
+
"{}.eighty?"
|
|
1279
|
+
]
|
|
1280
|
+
},
|
|
1281
|
+
"eighty_one?" => {
|
|
1282
|
+
name: "eighty_one?",
|
|
1283
|
+
description: "returns whether the dictionary size is eighty one.",
|
|
1284
|
+
examples: [
|
|
1285
|
+
"Dictionary.from_entries((1..81).to_list.map((x) => { [x, x] })).eighty_one?",
|
|
1286
|
+
"Dictionary.from_entries((1..82).to_list.map((x) => { [x, x] })).eighty_one?",
|
|
1287
|
+
"{}.eighty_one?"
|
|
1288
|
+
]
|
|
1289
|
+
},
|
|
1290
|
+
"eighty_two?" => {
|
|
1291
|
+
name: "eighty_two?",
|
|
1292
|
+
description: "returns whether the dictionary size is eighty two.",
|
|
1293
|
+
examples: [
|
|
1294
|
+
"Dictionary.from_entries((1..82).to_list.map((x) => { [x, x] })).eighty_two?",
|
|
1295
|
+
"Dictionary.from_entries((1..83).to_list.map((x) => { [x, x] })).eighty_two?",
|
|
1296
|
+
"{}.eighty_two?"
|
|
1297
|
+
]
|
|
1298
|
+
},
|
|
1299
|
+
"eighty_three?" => {
|
|
1300
|
+
name: "eighty_three?",
|
|
1301
|
+
description: "returns whether the dictionary size is eighty three.",
|
|
1302
|
+
examples: [
|
|
1303
|
+
"Dictionary.from_entries((1..83).to_list.map((x) => { [x, x] })).eighty_three?",
|
|
1304
|
+
"Dictionary.from_entries((1..84).to_list.map((x) => { [x, x] })).eighty_three?",
|
|
1305
|
+
"{}.eighty_three?"
|
|
1306
|
+
]
|
|
1307
|
+
},
|
|
1308
|
+
"eighty_four?" => {
|
|
1309
|
+
name: "eighty_four?",
|
|
1310
|
+
description: "returns whether the dictionary size is eighty four.",
|
|
1311
|
+
examples: [
|
|
1312
|
+
"Dictionary.from_entries((1..84).to_list.map((x) => { [x, x] })).eighty_four?",
|
|
1313
|
+
"Dictionary.from_entries((1..85).to_list.map((x) => { [x, x] })).eighty_four?",
|
|
1314
|
+
"{}.eighty_four?"
|
|
1315
|
+
]
|
|
1316
|
+
},
|
|
1317
|
+
"eighty_five?" => {
|
|
1318
|
+
name: "eighty_five?",
|
|
1319
|
+
description: "returns whether the dictionary size is eighty five.",
|
|
1320
|
+
examples: [
|
|
1321
|
+
"Dictionary.from_entries((1..85).to_list.map((x) => { [x, x] })).eighty_five?",
|
|
1322
|
+
"Dictionary.from_entries((1..86).to_list.map((x) => { [x, x] })).eighty_five?",
|
|
1323
|
+
"{}.eighty_five?"
|
|
1324
|
+
]
|
|
1325
|
+
},
|
|
1326
|
+
"eighty_six?" => {
|
|
1327
|
+
name: "eighty_six?",
|
|
1328
|
+
description: "returns whether the dictionary size is eighty six.",
|
|
1329
|
+
examples: [
|
|
1330
|
+
"Dictionary.from_entries((1..86).to_list.map((x) => { [x, x] })).eighty_six?",
|
|
1331
|
+
"Dictionary.from_entries((1..87).to_list.map((x) => { [x, x] })).eighty_six?",
|
|
1332
|
+
"{}.eighty_six?"
|
|
1333
|
+
]
|
|
1334
|
+
},
|
|
1335
|
+
"eighty_seven?" => {
|
|
1336
|
+
name: "eighty_seven?",
|
|
1337
|
+
description: "returns whether the dictionary size is eighty seven.",
|
|
1338
|
+
examples: [
|
|
1339
|
+
"Dictionary.from_entries((1..87).to_list.map((x) => { [x, x] })).eighty_seven?",
|
|
1340
|
+
"Dictionary.from_entries((1..88).to_list.map((x) => { [x, x] })).eighty_seven?",
|
|
1341
|
+
"{}.eighty_seven?"
|
|
1342
|
+
]
|
|
1343
|
+
},
|
|
1344
|
+
"eighty_eight?" => {
|
|
1345
|
+
name: "eighty_eight?",
|
|
1346
|
+
description: "returns whether the dictionary size is eighty eight.",
|
|
1347
|
+
examples: [
|
|
1348
|
+
"Dictionary.from_entries((1..88).to_list.map((x) => { [x, x] })).eighty_eight?",
|
|
1349
|
+
"Dictionary.from_entries((1..89).to_list.map((x) => { [x, x] })).eighty_eight?",
|
|
1350
|
+
"{}.eighty_eight?"
|
|
1351
|
+
]
|
|
1352
|
+
},
|
|
1353
|
+
"eighty_nine?" => {
|
|
1354
|
+
name: "eighty_nine?",
|
|
1355
|
+
description: "returns whether the dictionary size is eighty nine.",
|
|
1356
|
+
examples: [
|
|
1357
|
+
"Dictionary.from_entries((1..89).to_list.map((x) => { [x, x] })).eighty_nine?",
|
|
1358
|
+
"Dictionary.from_entries((1..90).to_list.map((x) => { [x, x] })).eighty_nine?",
|
|
1359
|
+
"{}.eighty_nine?"
|
|
1360
|
+
]
|
|
1361
|
+
},
|
|
1362
|
+
"ninety?" => {
|
|
1363
|
+
name: "ninety?",
|
|
1364
|
+
description: "returns whether the dictionary size is ninety.",
|
|
1365
|
+
examples: [
|
|
1366
|
+
"Dictionary.from_entries((1..90).to_list.map((x) => { [x, x] })).ninety?",
|
|
1367
|
+
"Dictionary.from_entries((1..91).to_list.map((x) => { [x, x] })).ninety?",
|
|
1368
|
+
"{}.ninety?"
|
|
1369
|
+
]
|
|
1370
|
+
},
|
|
1371
|
+
"ninety_one?" => {
|
|
1372
|
+
name: "ninety_one?",
|
|
1373
|
+
description: "returns whether the dictionary size is ninety one.",
|
|
1374
|
+
examples: [
|
|
1375
|
+
"Dictionary.from_entries((1..91).to_list.map((x) => { [x, x] })).ninety_one?",
|
|
1376
|
+
"Dictionary.from_entries((1..92).to_list.map((x) => { [x, x] })).ninety_one?",
|
|
1377
|
+
"{}.ninety_one?"
|
|
1378
|
+
]
|
|
1379
|
+
},
|
|
1380
|
+
"ninety_two?" => {
|
|
1381
|
+
name: "ninety_two?",
|
|
1382
|
+
description: "returns whether the dictionary size is ninety two.",
|
|
1383
|
+
examples: [
|
|
1384
|
+
"Dictionary.from_entries((1..92).to_list.map((x) => { [x, x] })).ninety_two?",
|
|
1385
|
+
"Dictionary.from_entries((1..93).to_list.map((x) => { [x, x] })).ninety_two?",
|
|
1386
|
+
"{}.ninety_two?"
|
|
1387
|
+
]
|
|
1388
|
+
},
|
|
1389
|
+
"ninety_three?" => {
|
|
1390
|
+
name: "ninety_three?",
|
|
1391
|
+
description: "returns whether the dictionary size is ninety three.",
|
|
1392
|
+
examples: [
|
|
1393
|
+
"Dictionary.from_entries((1..93).to_list.map((x) => { [x, x] })).ninety_three?",
|
|
1394
|
+
"Dictionary.from_entries((1..94).to_list.map((x) => { [x, x] })).ninety_three?",
|
|
1395
|
+
"{}.ninety_three?"
|
|
1396
|
+
]
|
|
1397
|
+
},
|
|
1398
|
+
"ninety_four?" => {
|
|
1399
|
+
name: "ninety_four?",
|
|
1400
|
+
description: "returns whether the dictionary size is ninety four.",
|
|
1401
|
+
examples: [
|
|
1402
|
+
"Dictionary.from_entries((1..94).to_list.map((x) => { [x, x] })).ninety_four?",
|
|
1403
|
+
"Dictionary.from_entries((1..95).to_list.map((x) => { [x, x] })).ninety_four?",
|
|
1404
|
+
"{}.ninety_four?"
|
|
1405
|
+
]
|
|
1406
|
+
},
|
|
1407
|
+
"ninety_five?" => {
|
|
1408
|
+
name: "ninety_five?",
|
|
1409
|
+
description: "returns whether the dictionary size is ninety five.",
|
|
1410
|
+
examples: [
|
|
1411
|
+
"Dictionary.from_entries((1..95).to_list.map((x) => { [x, x] })).ninety_five?",
|
|
1412
|
+
"Dictionary.from_entries((1..96).to_list.map((x) => { [x, x] })).ninety_five?",
|
|
1413
|
+
"{}.ninety_five?"
|
|
1414
|
+
]
|
|
1415
|
+
},
|
|
1416
|
+
"ninety_six?" => {
|
|
1417
|
+
name: "ninety_six?",
|
|
1418
|
+
description: "returns whether the dictionary size is ninety six.",
|
|
1419
|
+
examples: [
|
|
1420
|
+
"Dictionary.from_entries((1..96).to_list.map((x) => { [x, x] })).ninety_six?",
|
|
1421
|
+
"Dictionary.from_entries((1..97).to_list.map((x) => { [x, x] })).ninety_six?",
|
|
1422
|
+
"{}.ninety_six?"
|
|
1423
|
+
]
|
|
1424
|
+
},
|
|
1425
|
+
"ninety_seven?" => {
|
|
1426
|
+
name: "ninety_seven?",
|
|
1427
|
+
description: "returns whether the dictionary size is ninety seven.",
|
|
1428
|
+
examples: [
|
|
1429
|
+
"Dictionary.from_entries((1..97).to_list.map((x) => { [x, x] })).ninety_seven?",
|
|
1430
|
+
"Dictionary.from_entries((1..98).to_list.map((x) => { [x, x] })).ninety_seven?",
|
|
1431
|
+
"{}.ninety_seven?"
|
|
1432
|
+
]
|
|
1433
|
+
},
|
|
1434
|
+
"ninety_eight?" => {
|
|
1435
|
+
name: "ninety_eight?",
|
|
1436
|
+
description: "returns whether the dictionary size is ninety eight.",
|
|
1437
|
+
examples: [
|
|
1438
|
+
"Dictionary.from_entries((1..98).to_list.map((x) => { [x, x] })).ninety_eight?",
|
|
1439
|
+
"Dictionary.from_entries((1..99).to_list.map((x) => { [x, x] })).ninety_eight?",
|
|
1440
|
+
"{}.ninety_eight?"
|
|
1441
|
+
]
|
|
1442
|
+
},
|
|
1443
|
+
"ninety_nine?" => {
|
|
1444
|
+
name: "ninety_nine?",
|
|
1445
|
+
description: "returns whether the dictionary size is ninety nine.",
|
|
1446
|
+
examples: [
|
|
1447
|
+
"Dictionary.from_entries((1..99).to_list.map((x) => { [x, x] })).ninety_nine?",
|
|
1448
|
+
"Dictionary.from_entries((1..100).to_list.map((x) => { [x, x] })).ninety_nine?",
|
|
1449
|
+
"{}.ninety_nine?"
|
|
1450
|
+
]
|
|
1451
|
+
},
|
|
1452
|
+
"one_hundred?" => {
|
|
1453
|
+
name: "one_hundred?",
|
|
1454
|
+
description: "returns whether the dictionary size is one hundred.",
|
|
1455
|
+
examples: [
|
|
1456
|
+
"Dictionary.from_entries((1..100).to_list.map((x) => { [x, x] })).one_hundred?",
|
|
1457
|
+
"Dictionary.from_entries((1..101).to_list.map((x) => { [x, x] })).one_hundred?",
|
|
1458
|
+
"{}.one_hundred?"
|
|
1459
|
+
]
|
|
1460
|
+
}
|
|
1461
|
+
}.freeze
|
|
1462
|
+
|
|
1463
|
+
def self.function_documentation(scope)
|
|
1464
|
+
return INSTANCE_FUNCTIONS if scope == :instance
|
|
1465
|
+
return CLASS_FUNCTIONS if scope == :class
|
|
1466
|
+
|
|
1467
|
+
{}
|
|
1468
|
+
end
|
|
1469
|
+
|
|
6
1470
|
delegate(
|
|
7
1471
|
:code_many?,
|
|
8
1472
|
:code_positive?,
|
|
@@ -129,6 +1593,29 @@ class Code
|
|
|
129
1593
|
.merge(kargs.transform_keys(&:to_code).transform_values(&:to_code))
|
|
130
1594
|
end
|
|
131
1595
|
|
|
1596
|
+
def self.call(**args)
|
|
1597
|
+
code_operator = args.fetch(:operator, nil).to_code
|
|
1598
|
+
code_arguments = args.fetch(:arguments, List.new).to_code
|
|
1599
|
+
code_value = code_arguments.code_first
|
|
1600
|
+
|
|
1601
|
+
case code_operator.to_s
|
|
1602
|
+
when "entries"
|
|
1603
|
+
sig(args) { Dictionary }
|
|
1604
|
+
code_entries(code_value)
|
|
1605
|
+
when "from_entries"
|
|
1606
|
+
sig(args) { List }
|
|
1607
|
+
code_from_entries(code_value)
|
|
1608
|
+
when "assign"
|
|
1609
|
+
sig(args) { Dictionary.repeat(1) }
|
|
1610
|
+
code_assign(*code_arguments.raw)
|
|
1611
|
+
when "has_own?"
|
|
1612
|
+
sig(args) { [Dictionary, Object] }
|
|
1613
|
+
code_has_own?(*code_arguments.raw)
|
|
1614
|
+
else
|
|
1615
|
+
super
|
|
1616
|
+
end
|
|
1617
|
+
end
|
|
1618
|
+
|
|
132
1619
|
def call(**args)
|
|
133
1620
|
code_operator = args.fetch(:operator, nil).to_code
|
|
134
1621
|
code_arguments = args.fetch(:arguments, List.new).to_code
|
|
@@ -171,6 +1658,15 @@ class Code
|
|
|
171
1658
|
when "each"
|
|
172
1659
|
sig(args) { Function }
|
|
173
1660
|
code_each(code_value, **globals)
|
|
1661
|
+
when "each_key"
|
|
1662
|
+
sig(args) { Function }
|
|
1663
|
+
code_each_key(code_value, **globals)
|
|
1664
|
+
when "each_value"
|
|
1665
|
+
sig(args) { Function }
|
|
1666
|
+
code_each_value(code_value, **globals)
|
|
1667
|
+
when "each_pair"
|
|
1668
|
+
sig(args) { Function }
|
|
1669
|
+
code_each_pair(code_value, **globals)
|
|
174
1670
|
when "empty?"
|
|
175
1671
|
sig(args)
|
|
176
1672
|
code_empty?
|
|
@@ -186,10 +1682,13 @@ class Code
|
|
|
186
1682
|
when "flatten"
|
|
187
1683
|
sig(args) { Integer.maybe }
|
|
188
1684
|
code_flatten(code_value)
|
|
189
|
-
when "has_key?"
|
|
1685
|
+
when "has_key?", "key?", "include?", "member?"
|
|
190
1686
|
sig(args) { Object }
|
|
191
1687
|
code_has_key?(code_value)
|
|
192
|
-
when "
|
|
1688
|
+
when "has_own?"
|
|
1689
|
+
sig(args) { Object }
|
|
1690
|
+
code_has_own?(code_value)
|
|
1691
|
+
when "has_value?", "value?"
|
|
193
1692
|
sig(args) { Object }
|
|
194
1693
|
code_has_value?(code_value)
|
|
195
1694
|
when "invert"
|
|
@@ -207,30 +1706,81 @@ class Code
|
|
|
207
1706
|
when "keys"
|
|
208
1707
|
sig(args)
|
|
209
1708
|
code_keys
|
|
1709
|
+
when "map"
|
|
1710
|
+
sig(args) { Function }
|
|
1711
|
+
code_map(code_value, **globals)
|
|
210
1712
|
when "merge"
|
|
211
1713
|
sig(args) { [Dictionary.repeat, Function.maybe] }
|
|
212
1714
|
code_merge(*code_arguments.raw, **globals)
|
|
213
1715
|
when "merge!"
|
|
214
1716
|
sig(args) { [Dictionary.repeat, Function.maybe] }
|
|
215
1717
|
code_merge!(*code_arguments.raw, **globals)
|
|
1718
|
+
when "update"
|
|
1719
|
+
sig(args) { [Dictionary.repeat, Function.maybe] }
|
|
1720
|
+
code_update(*code_arguments.raw, **globals)
|
|
1721
|
+
when "replace"
|
|
1722
|
+
sig(args) { Dictionary }
|
|
1723
|
+
code_replace(code_value)
|
|
1724
|
+
when "store", "set"
|
|
1725
|
+
sig(args) { [Object, Object] }
|
|
1726
|
+
code_store(*code_arguments.raw)
|
|
1727
|
+
when "shift"
|
|
1728
|
+
sig(args)
|
|
1729
|
+
code_shift
|
|
1730
|
+
when "reject!"
|
|
1731
|
+
sig(args) { Function | Class }
|
|
1732
|
+
code_reject!(code_value, **globals)
|
|
1733
|
+
when "reject"
|
|
1734
|
+
sig(args) { Function | Class }
|
|
1735
|
+
code_reject(code_value, **globals)
|
|
216
1736
|
when "select!", "filter!"
|
|
217
1737
|
sig(args) { Function | Class }
|
|
218
1738
|
code_select!(code_value, **globals)
|
|
219
1739
|
when "select", "filter"
|
|
220
1740
|
sig(args) { Function | Class }
|
|
221
1741
|
code_select(code_value, **globals)
|
|
222
|
-
when "size"
|
|
1742
|
+
when "size", "length"
|
|
223
1743
|
sig(args)
|
|
224
1744
|
code_size
|
|
1745
|
+
when "slice"
|
|
1746
|
+
sig(args) { Object.repeat(1) }
|
|
1747
|
+
code_slice(*code_arguments.raw)
|
|
1748
|
+
when "transform_keys"
|
|
1749
|
+
sig(args) { Function }
|
|
1750
|
+
code_transform_keys(code_value, **globals)
|
|
1751
|
+
when "transform_keys!"
|
|
1752
|
+
sig(args) { Function }
|
|
1753
|
+
code_transform_keys!(code_value, **globals)
|
|
225
1754
|
when "transform_values"
|
|
226
1755
|
sig(args) { Function }
|
|
227
1756
|
code_transform_values(code_value, **globals)
|
|
1757
|
+
when "transform_values!"
|
|
1758
|
+
sig(args) { Function }
|
|
1759
|
+
code_transform_values!(code_value, **globals)
|
|
228
1760
|
when "to_query"
|
|
229
1761
|
sig(args) { String.maybe }
|
|
230
1762
|
code_to_query(code_value)
|
|
231
|
-
when "
|
|
1763
|
+
when "to_list", "entries"
|
|
1764
|
+
sig(args)
|
|
1765
|
+
code_to_list
|
|
1766
|
+
when "to_dictionary"
|
|
232
1767
|
sig(args)
|
|
233
|
-
|
|
1768
|
+
code_to_dictionary
|
|
1769
|
+
when "to_context"
|
|
1770
|
+
sig(args)
|
|
1771
|
+
code_to_context
|
|
1772
|
+
when "values"
|
|
1773
|
+
sig(args) { [Object.repeat, Function.maybe] }
|
|
1774
|
+
code_values(*code_arguments.raw, **globals)
|
|
1775
|
+
when "values_at"
|
|
1776
|
+
sig(args) { Object.repeat(1) }
|
|
1777
|
+
code_values_at(*code_arguments.raw)
|
|
1778
|
+
when "associate"
|
|
1779
|
+
sig(args) { Object }
|
|
1780
|
+
code_associate(code_value)
|
|
1781
|
+
when "right_associate"
|
|
1782
|
+
sig(args) { Object }
|
|
1783
|
+
code_right_associate(code_value)
|
|
234
1784
|
when "many?"
|
|
235
1785
|
sig(args)
|
|
236
1786
|
code_many?
|
|
@@ -590,6 +2140,22 @@ class Code
|
|
|
590
2140
|
self
|
|
591
2141
|
end
|
|
592
2142
|
|
|
2143
|
+
def self.code_entries(dictionary)
|
|
2144
|
+
dictionary.to_code.code_to_list
|
|
2145
|
+
end
|
|
2146
|
+
|
|
2147
|
+
def self.code_from_entries(entries)
|
|
2148
|
+
entries.to_code.code_to_dictionary
|
|
2149
|
+
end
|
|
2150
|
+
|
|
2151
|
+
def self.code_assign(*dictionaries)
|
|
2152
|
+
Dictionary.new(dictionaries.to_code.raw.reduce({}) { |acc, item| acc.merge(item.raw) })
|
|
2153
|
+
end
|
|
2154
|
+
|
|
2155
|
+
def self.code_has_own?(dictionary, key)
|
|
2156
|
+
dictionary.to_code.code_has_key?(key)
|
|
2157
|
+
end
|
|
2158
|
+
|
|
593
2159
|
def code_compact(argument = nil, **globals)
|
|
594
2160
|
code_argument = argument.to_code
|
|
595
2161
|
|
|
@@ -764,6 +2330,31 @@ class Code
|
|
|
764
2330
|
e.code_value
|
|
765
2331
|
end
|
|
766
2332
|
|
|
2333
|
+
def code_each_key(argument, **globals)
|
|
2334
|
+
code_argument = argument.to_code
|
|
2335
|
+
|
|
2336
|
+
raw.each.with_index do |(key, value), index|
|
|
2337
|
+
code_argument.call(
|
|
2338
|
+
arguments: List.new([key, value, Integer.new(index), self]),
|
|
2339
|
+
**globals
|
|
2340
|
+
)
|
|
2341
|
+
rescue Error::Next => e
|
|
2342
|
+
e.code_value
|
|
2343
|
+
end
|
|
2344
|
+
|
|
2345
|
+
self
|
|
2346
|
+
rescue Error::Break => e
|
|
2347
|
+
e.code_value
|
|
2348
|
+
end
|
|
2349
|
+
|
|
2350
|
+
def code_each_value(argument, **globals)
|
|
2351
|
+
code_each_key(argument, **globals)
|
|
2352
|
+
end
|
|
2353
|
+
|
|
2354
|
+
def code_each_pair(argument, **globals)
|
|
2355
|
+
code_each_key(argument, **globals)
|
|
2356
|
+
end
|
|
2357
|
+
|
|
767
2358
|
def code_empty?
|
|
768
2359
|
Boolean.new(raw.empty?)
|
|
769
2360
|
end
|
|
@@ -849,6 +2440,10 @@ class Code
|
|
|
849
2440
|
Boolean.new(raw.key?(code_key))
|
|
850
2441
|
end
|
|
851
2442
|
|
|
2443
|
+
def code_has_own?(key)
|
|
2444
|
+
code_has_key?(key)
|
|
2445
|
+
end
|
|
2446
|
+
|
|
852
2447
|
def code_has_value?(key)
|
|
853
2448
|
code_key = key.to_code
|
|
854
2449
|
Boolean.new(raw.value?(code_key))
|
|
@@ -918,6 +2513,23 @@ class Code
|
|
|
918
2513
|
List.new(raw.keys)
|
|
919
2514
|
end
|
|
920
2515
|
|
|
2516
|
+
def code_map(function, **globals)
|
|
2517
|
+
code_function = function.to_code
|
|
2518
|
+
|
|
2519
|
+
List.new(
|
|
2520
|
+
raw.map.with_index do |(key, value), index|
|
|
2521
|
+
code_function.call(
|
|
2522
|
+
arguments: List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2523
|
+
**globals
|
|
2524
|
+
)
|
|
2525
|
+
rescue Error::Next => e
|
|
2526
|
+
e.code_value
|
|
2527
|
+
end
|
|
2528
|
+
)
|
|
2529
|
+
rescue Error::Break => e
|
|
2530
|
+
e.code_value
|
|
2531
|
+
end
|
|
2532
|
+
|
|
921
2533
|
def code_merge(*arguments, **globals)
|
|
922
2534
|
arguments = arguments.to_code.raw
|
|
923
2535
|
|
|
@@ -1000,6 +2612,27 @@ class Code
|
|
|
1000
2612
|
e.code_value
|
|
1001
2613
|
end
|
|
1002
2614
|
|
|
2615
|
+
def code_update(*arguments, **globals)
|
|
2616
|
+
code_merge!(*arguments, **globals)
|
|
2617
|
+
end
|
|
2618
|
+
|
|
2619
|
+
def code_replace(dictionary)
|
|
2620
|
+
code_dictionary = dictionary.to_code
|
|
2621
|
+
|
|
2622
|
+
self.raw = code_dictionary.raw.dup
|
|
2623
|
+
self
|
|
2624
|
+
end
|
|
2625
|
+
|
|
2626
|
+
def code_store(key, value)
|
|
2627
|
+
code_set(key, value)
|
|
2628
|
+
end
|
|
2629
|
+
|
|
2630
|
+
def code_shift
|
|
2631
|
+
pair = raw.shift
|
|
2632
|
+
|
|
2633
|
+
pair ? List.new(pair) : Nothing.new
|
|
2634
|
+
end
|
|
2635
|
+
|
|
1003
2636
|
def code_select!(argument, **globals)
|
|
1004
2637
|
code_argument = argument.to_code
|
|
1005
2638
|
|
|
@@ -1046,6 +2679,48 @@ class Code
|
|
|
1046
2679
|
e.code_value
|
|
1047
2680
|
end
|
|
1048
2681
|
|
|
2682
|
+
def code_reject!(argument, **globals)
|
|
2683
|
+
code_argument = argument.to_code
|
|
2684
|
+
|
|
2685
|
+
if code_argument.is_a?(Class)
|
|
2686
|
+
raw.reject! { |_, value| value.is_a?(code_argument.raw) }
|
|
2687
|
+
else
|
|
2688
|
+
raw.reject!.with_index do |(key, value), index|
|
|
2689
|
+
code_argument.call(
|
|
2690
|
+
arguments: List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2691
|
+
**globals
|
|
2692
|
+
).truthy?
|
|
2693
|
+
rescue Error::Next => e
|
|
2694
|
+
e.code_value.truthy?
|
|
2695
|
+
end
|
|
2696
|
+
end
|
|
2697
|
+
|
|
2698
|
+
self
|
|
2699
|
+
rescue Error::Break => e
|
|
2700
|
+
e.code_value
|
|
2701
|
+
end
|
|
2702
|
+
|
|
2703
|
+
def code_reject(argument, **globals)
|
|
2704
|
+
code_argument = argument.to_code
|
|
2705
|
+
|
|
2706
|
+
if code_argument.is_a?(Class)
|
|
2707
|
+
Dictionary.new(raw.reject { |_, value| value.is_a?(code_argument.raw) })
|
|
2708
|
+
else
|
|
2709
|
+
Dictionary.new(
|
|
2710
|
+
raw.reject.with_index do |(key, value), index|
|
|
2711
|
+
code_argument.call(
|
|
2712
|
+
arguments: List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2713
|
+
**globals
|
|
2714
|
+
).truthy?
|
|
2715
|
+
rescue Error::Next => e
|
|
2716
|
+
e.code_value.truthy?
|
|
2717
|
+
end
|
|
2718
|
+
)
|
|
2719
|
+
end
|
|
2720
|
+
rescue Error::Break => e
|
|
2721
|
+
e.code_value
|
|
2722
|
+
end
|
|
2723
|
+
|
|
1049
2724
|
def code_set(key, value)
|
|
1050
2725
|
code_key = key.to_code
|
|
1051
2726
|
code_value = value.to_code
|
|
@@ -1057,6 +2732,19 @@ class Code
|
|
|
1057
2732
|
Integer.new(raw.size)
|
|
1058
2733
|
end
|
|
1059
2734
|
|
|
2735
|
+
def code_slice(*arguments)
|
|
2736
|
+
code_arguments = arguments.to_code
|
|
2737
|
+
Dictionary.new(raw.slice(*code_arguments.raw))
|
|
2738
|
+
end
|
|
2739
|
+
|
|
2740
|
+
def code_to_list
|
|
2741
|
+
List.new(raw.map { |key, value| List.new([key, value]) })
|
|
2742
|
+
end
|
|
2743
|
+
|
|
2744
|
+
def code_to_dictionary
|
|
2745
|
+
self
|
|
2746
|
+
end
|
|
2747
|
+
|
|
1060
2748
|
def code_to_context
|
|
1061
2749
|
Context.new(raw)
|
|
1062
2750
|
end
|
|
@@ -1067,6 +2755,34 @@ class Code
|
|
|
1067
2755
|
String.new(raw.to_query(code_namespace.raw))
|
|
1068
2756
|
end
|
|
1069
2757
|
|
|
2758
|
+
def code_transform_keys(function, **globals)
|
|
2759
|
+
code_function = function.to_code
|
|
2760
|
+
|
|
2761
|
+
Dictionary.new(
|
|
2762
|
+
raw
|
|
2763
|
+
.map
|
|
2764
|
+
.with_index do |(key, value), index|
|
|
2765
|
+
[
|
|
2766
|
+
code_function.call(
|
|
2767
|
+
arguments: List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2768
|
+
**globals
|
|
2769
|
+
),
|
|
2770
|
+
value.to_code
|
|
2771
|
+
]
|
|
2772
|
+
rescue Error::Next => e
|
|
2773
|
+
[e.code_value, value.to_code]
|
|
2774
|
+
end
|
|
2775
|
+
.to_h
|
|
2776
|
+
)
|
|
2777
|
+
rescue Error::Break => e
|
|
2778
|
+
e.code_value
|
|
2779
|
+
end
|
|
2780
|
+
|
|
2781
|
+
def code_transform_keys!(function, **globals)
|
|
2782
|
+
self.raw = code_transform_keys(function, **globals).raw
|
|
2783
|
+
self
|
|
2784
|
+
end
|
|
2785
|
+
|
|
1070
2786
|
def code_transform_values(function, **globals)
|
|
1071
2787
|
code_function = function.to_code
|
|
1072
2788
|
|
|
@@ -1091,14 +2807,77 @@ class Code
|
|
|
1091
2807
|
e.code_value
|
|
1092
2808
|
end
|
|
1093
2809
|
|
|
1094
|
-
def
|
|
1095
|
-
|
|
2810
|
+
def code_transform_values!(function, **globals)
|
|
2811
|
+
self.raw = code_transform_values(function, **globals).raw
|
|
2812
|
+
self
|
|
1096
2813
|
end
|
|
1097
2814
|
|
|
1098
|
-
def
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
2815
|
+
def code_values(*arguments, **globals)
|
|
2816
|
+
arguments = arguments.to_code.raw
|
|
2817
|
+
code_function =
|
|
2818
|
+
(arguments.last if arguments.last.is_a?(Function)).to_code
|
|
2819
|
+
|
|
2820
|
+
arguments = arguments[..-2] unless code_function.nothing?
|
|
2821
|
+
|
|
2822
|
+
entries =
|
|
2823
|
+
if arguments.empty?
|
|
2824
|
+
raw.to_a
|
|
2825
|
+
else
|
|
2826
|
+
arguments.map { |key| [key, raw.fetch(key, Nothing.new)] }
|
|
2827
|
+
end
|
|
2828
|
+
|
|
2829
|
+
if code_function.nothing?
|
|
2830
|
+
List.new(entries.map(&:second))
|
|
2831
|
+
else
|
|
2832
|
+
List.new(
|
|
2833
|
+
entries.map.with_index do |(key, value), index|
|
|
2834
|
+
code_function.call(
|
|
2835
|
+
arguments: List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2836
|
+
**globals
|
|
2837
|
+
)
|
|
2838
|
+
rescue Error::Next => e
|
|
2839
|
+
e.code_value
|
|
2840
|
+
end
|
|
2841
|
+
)
|
|
2842
|
+
end
|
|
2843
|
+
rescue Error::Break => e
|
|
2844
|
+
e.code_value
|
|
2845
|
+
end
|
|
2846
|
+
|
|
2847
|
+
def code_values_at(*keys)
|
|
2848
|
+
code_keys = keys.to_code
|
|
2849
|
+
|
|
2850
|
+
List.new(raw.values_at(*code_keys.raw))
|
|
2851
|
+
end
|
|
2852
|
+
|
|
2853
|
+
def code_associate(key)
|
|
2854
|
+
code_key = key.to_code
|
|
2855
|
+
|
|
2856
|
+
raw.key?(code_key) ? List.new([code_key, raw[code_key]]) : Nothing.new
|
|
2857
|
+
end
|
|
2858
|
+
|
|
2859
|
+
def code_right_associate(value)
|
|
2860
|
+
code_value = value.to_code
|
|
2861
|
+
pair = raw.detect { |_, entry_value| entry_value == code_value }
|
|
2862
|
+
|
|
2863
|
+
pair ? List.new(pair) : Nothing.new
|
|
2864
|
+
end
|
|
2865
|
+
|
|
2866
|
+
def code_deep_duplicate(seen = {})
|
|
2867
|
+
seen.compare_by_identity unless seen.compare_by_identity?
|
|
2868
|
+
return seen[self] if seen.key?(self)
|
|
2869
|
+
|
|
2870
|
+
duplicate = Dictionary.new
|
|
2871
|
+
seen[self] = duplicate
|
|
2872
|
+
|
|
2873
|
+
raw.each do |key, value|
|
|
2874
|
+
duplicate.code_set(
|
|
2875
|
+
key.code_deep_duplicate(seen),
|
|
2876
|
+
value.code_deep_duplicate(seen)
|
|
2877
|
+
)
|
|
2878
|
+
end
|
|
2879
|
+
|
|
2880
|
+
duplicate
|
|
1102
2881
|
end
|
|
1103
2882
|
|
|
1104
2883
|
def <=>(other)
|