Class: Code::Object::List

Inherits:
Code::Object show all
Defined in:
lib/code/object/list.rb

Direct Known Subclasses

IdentifierList

Constant Summary

Constants inherited from Code::Object

NUMBER_CLASSES

Instance Attribute Summary

Attributes included from Concerns::Shared

#methods, #raw

Instance Method Summary collapse

Methods inherited from Code::Object

code_new, #code_new, maybe, #name, repeat, |

Methods included from Concerns::Shared

#<=>, #==, #as_json, #blank?, #code_and, #code_as_json, #code_blank?, #code_compare, #code_different, #code_duplicate, #code_equal, #code_exclamation_mark, #code_exclusive_range, #code_falsy?, code_fetch, code_get, #code_greater, #code_greater_or_equal, #code_inclusive_range, #code_inspect, #code_less, #code_less_or_equal, #code_methods, #code_name, #code_nothing?, #code_or, #code_presence, #code_presence_in, #code_present?, #code_self, code_set, #code_something?, #code_strict_different, #code_strict_equal, #code_to_boolean, #code_to_class, #code_to_date, #code_to_decimal, #code_to_dictionary, #code_to_duration, #code_to_integer, #code_to_json, #code_to_list, #code_to_nothing, #code_to_parameter, #code_to_range, #code_to_string, #code_to_time, #code_truthy?, #eql?, #falsy?, #hash, #inspect, #multi_fetch, #nothing?, #sig, #something?, #succ, #to_code, #to_i, #to_json, #to_s, #truthy?

Constructor Details

#initialize(*args, **_kargs, &_block) ⇒ List

Returns a new instance of List.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/code/object/list.rb', line 114

def initialize(*args, **_kargs, &_block)
  self.raw =
    if args.first.is_a?(List)
      args.first.raw.map(&:to_code)
    elsif args.first.is_a?(Dictionary)
      args.first.raw.to_a.map(&:to_code)
    elsif args.first.is_an?(::Array)
      args.first.map(&:to_code)
    elsif args.first.is_a?(::Hash)
      args.first.to_a.map(&:to_code)
    else
      []
    end
end

Instance Method Details

#any?Boolean

Returns:



1796
1797
1798
# File 'lib/code/object/list.rb', line 1796

def any?
  code_any?.truthy?
end

#call(**args) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
# File 'lib/code/object/list.rb', line 129

def call(**args)
  code_operator = args.fetch(:operator, nil).to_code
  code_arguments = args.fetch(:arguments, []).to_code
  globals = multi_fetch(args, *GLOBALS)
  code_value = code_arguments.code_first

  case code_operator.to_s
  when "join"
    sig(args) { String.maybe }
    code_join(code_value)
  when "sort"
    sig(args) { Function.maybe }
    code_sort(code_value, **globals)
  when "<<", "append"
    sig(args) { Object }
    code_append(code_value)
  when "+", "plus"
    sig(args) { List.maybe }
    code_arguments.any? ? code_plus(code_value) : code_self
  when "-", "minus"
    sig(args) { List }
    code_minus(code_value)
  when "any?"
    sig(args) { (Function | Class).maybe }
    code_any?(code_value, **globals)
  when "detect"
    sig(args) { (Function | Class).maybe }
    code_detect(code_value, **globals)
  when "each"
    sig(args) { (Function | Class).maybe }
    code_each(code_value, **globals)
  when "first"
    sig(args) { Integer.maybe }
    code_first(code_value)
  when "second"
    sig(args)
    code_second
  when "third"
    sig(args)
    code_third
  when "fourth"
    sig(args)
    code_fourth
  when "fifth"
    sig(args)
    code_fifth
  when "sixth"
    sig(args)
    code_sixth
  when "seventh"
    sig(args)
    code_seventh
  when "eighth"
    sig(args)
    code_eighth
  when "ninth"
    sig(args)
    code_ninth
  when "tenth"
    sig(args)
    code_tenth
  when "eleventh"
    sig(args)
    code_eleventh
  when "twelfth"
    sig(args)
    code_twelfth
  when "thirteenth"
    sig(args)
    code_thirteenth
  when "fourteenth"
    sig(args)
    code_fourteenth
  when "fifteenth"
    sig(args)
    code_fifteenth
  when "sixteenth"
    sig(args)
    code_sixteenth
  when "seventeenth"
    sig(args)
    code_seventeenth
  when "eighteenth"
    sig(args)
    code_eighteenth
  when "nineteenth"
    sig(args)
    code_nineteenth
  when "twentieth"
    sig(args)
    code_twentieth
  when "twenty_first"
    sig(args)
    code_twenty_first
  when "twenty_second"
    sig(args)
    code_twenty_second
  when "twenty_third"
    sig(args)
    code_twenty_third
  when "twenty_fourth"
    sig(args)
    code_twenty_fourth
  when "twenty_fifth"
    sig(args)
    code_twenty_fifth
  when "twenty_sixth"
    sig(args)
    code_twenty_sixth
  when "twenty_seventh"
    sig(args)
    code_twenty_seventh
  when "twenty_eighth"
    sig(args)
    code_twenty_eighth
  when "twenty_ninth"
    sig(args)
    code_twenty_ninth
  when "thirtieth"
    sig(args)
    code_thirtieth
  when "thirty_first"
    sig(args)
    code_thirty_first
  when "thirty_second"
    sig(args)
    code_thirty_second
  when "thirty_third"
    sig(args)
    code_thirty_third
  when "thirty_fourth"
    sig(args)
    code_thirty_fourth
  when "thirty_fifth"
    sig(args)
    code_thirty_fifth
  when "thirty_sixth"
    sig(args)
    code_thirty_sixth
  when "thirty_seventh"
    sig(args)
    code_thirty_seventh
  when "thirty_eighth"
    sig(args)
    code_thirty_eighth
  when "thirty_ninth"
    sig(args)
    code_thirty_ninth
  when "fortieth"
    sig(args)
    code_fortieth
  when "forty_first"
    sig(args)
    code_forty_first
  when "forty_second"
    sig(args)
    code_forty_second
  when "forty_third"
    sig(args)
    code_forty_third
  when "forty_fourth"
    sig(args)
    code_forty_fourth
  when "forty_fifth"
    sig(args)
    code_forty_fifth
  when "forty_sixth"
    sig(args)
    code_forty_sixth
  when "forty_seventh"
    sig(args)
    code_forty_seventh
  when "forty_eighth"
    sig(args)
    code_forty_eighth
  when "forty_ninth"
    sig(args)
    code_forty_ninth
  when "fiftieth"
    sig(args)
    code_fiftieth
  when "fifty_first"
    sig(args)
    code_fifty_first
  when "fifty_second"
    sig(args)
    code_fifty_second
  when "fifty_third"
    sig(args)
    code_fifty_third
  when "fifty_fourth"
    sig(args)
    code_fifty_fourth
  when "fifty_fifth"
    sig(args)
    code_fifty_fifth
  when "fifty_sixth"
    sig(args)
    code_fifty_sixth
  when "fifty_seventh"
    sig(args)
    code_fifty_seventh
  when "fifty_eighth"
    sig(args)
    code_fifty_eighth
  when "fifty_ninth"
    sig(args)
    code_fifty_ninth
  when "sixtieth"
    sig(args)
    code_sixtieth
  when "sixty_first"
    sig(args)
    code_sixty_first
  when "sixty_second"
    sig(args)
    code_sixty_second
  when "sixty_third"
    sig(args)
    code_sixty_third
  when "sixty_fourth"
    sig(args)
    code_sixty_fourth
  when "sixty_fifth"
    sig(args)
    code_sixty_fifth
  when "sixty_sixth"
    sig(args)
    code_sixty_sixth
  when "sixty_seventh"
    sig(args)
    code_sixty_seventh
  when "sixty_eighth"
    sig(args)
    code_sixty_eighth
  when "sixty_ninth"
    sig(args)
    code_sixty_ninth
  when "seventieth"
    sig(args)
    code_seventieth
  when "seventy_first"
    sig(args)
    code_seventy_first
  when "seventy_second"
    sig(args)
    code_seventy_second
  when "seventy_third"
    sig(args)
    code_seventy_third
  when "seventy_fourth"
    sig(args)
    code_seventy_fourth
  when "seventy_fifth"
    sig(args)
    code_seventy_fifth
  when "seventy_sixth"
    sig(args)
    code_seventy_sixth
  when "seventy_seventh"
    sig(args)
    code_seventy_seventh
  when "seventy_eighth"
    sig(args)
    code_seventy_eighth
  when "seventy_ninth"
    sig(args)
    code_seventy_ninth
  when "eightieth"
    sig(args)
    code_eightieth
  when "eighty_first"
    sig(args)
    code_eighty_first
  when "eighty_second"
    sig(args)
    code_eighty_second
  when "eighty_third"
    sig(args)
    code_eighty_third
  when "eighty_fourth"
    sig(args)
    code_eighty_fourth
  when "eighty_fifth"
    sig(args)
    code_eighty_fifth
  when "eighty_sixth"
    sig(args)
    code_eighty_sixth
  when "eighty_seventh"
    sig(args)
    code_eighty_seventh
  when "eighty_eighth"
    sig(args)
    code_eighty_eighth
  when "eighty_ninth"
    sig(args)
    code_eighty_ninth
  when "ninetieth"
    sig(args)
    code_ninetieth
  when "ninety_first"
    sig(args)
    code_ninety_first
  when "ninety_second"
    sig(args)
    code_ninety_second
  when "ninety_third"
    sig(args)
    code_ninety_third
  when "ninety_fourth"
    sig(args)
    code_ninety_fourth
  when "ninety_fifth"
    sig(args)
    code_ninety_fifth
  when "ninety_sixth"
    sig(args)
    code_ninety_sixth
  when "ninety_seventh"
    sig(args)
    code_ninety_seventh
  when "ninety_eighth"
    sig(args)
    code_ninety_eighth
  when "ninety_ninth"
    sig(args)
    code_ninety_ninth
  when "one_hundredth"
    sig(args)
    code_one_hundredth
  when "sample"
    sig(args) { Integer.maybe }
    code_sample(code_value)
  when "shuffle"
    sig(args)
    code_shuffle
  when "flatten"
    sig(args) { Integer.maybe }
    code_flatten(code_value)
  when "pop"
    sig(args) { Integer.maybe }
    code_pop(code_value)
  when "pop!"
    sig(args) { Integer.maybe }
    code_pop!(code_value)
  when "shift"
    sig(args) { Integer.maybe }
    code_shift(code_value)
  when "include?"
    sig(args) { Object }
    code_include?(code_value)
  when "last"
    sig(args)
    code_last
  when "map"
    sig(args) { (Function | Class).maybe }
    code_map(code_value, **globals)
  when "map!"
    sig(args) { (Function | Class).maybe }
    code_map!(code_value, **globals)
  when "max"
    sig(args) { (Function | Class).maybe }
    code_max(code_value, **globals)
  when "none?"
    sig(args) { (Function | Class).maybe }
    code_none?(code_value, **globals)
  when "all?"
    sig(args) { (Function | Class).maybe }
    code_all?(code_value, **globals)
  when "reduce"
    sig(args) { (Function | Class).maybe }
    code_reduce(code_value, **globals)
  when "reverse"
    sig(args)
    code_reverse
  when "select"
    sig(args) { (Function | Class).maybe }
    code_select(code_value, **globals)
  when "select!"
    sig(args) { (Function | Class).maybe }
    code_select!(code_value, **globals)
  when "compact"
    sig(args) { (Function | Class).maybe }
    code_compact(code_value, **globals)
  when "compact!"
    sig(args) { (Function | Class).maybe }
    code_compact!(code_value, **globals)
  when "reject"
    sig(args) { (Function | Class).maybe }
    code_reject(code_value, **globals)
  when "reject!"
    sig(args) { (Function | Class).maybe }
    code_reject!(code_value, **globals)
  when "size"
    sig(args)
    code_size
  when "sum"
    sig(args)
    code_sum
  when "uniq"
    sig(args) { (Function | Class).maybe }
    code_uniq(code_value, **globals)
  when "many?"
    sig(args)
    code_many?
  when "positive?"
    sig(args)
    code_positive?
  when "negative?"
    sig(args)
    code_negative?
  when "zero?"
    sig(args)
    code_zero?
  when "one?"
    sig(args)
    code_one?
  when "two?"
    sig(args)
    code_two?
  when "three?"
    sig(args)
    code_three?
  when "four?"
    sig(args)
    code_four?
  when "five?"
    sig(args)
    code_five?
  when "six?"
    sig(args)
    code_six?
  when "seven?"
    sig(args)
    code_seven?
  when "eight?"
    sig(args)
    code_eight?
  when "nine?"
    sig(args)
    code_nine?
  when "ten?"
    sig(args)
    code_ten?
  when "eleven?"
    sig(args)
    code_eleven?
  when "twelve?"
    sig(args)
    code_twelve?
  when "thirteen?"
    sig(args)
    code_thirteen?
  when "fourteen?"
    sig(args)
    code_fourteen?
  when "fifteen?"
    sig(args)
    code_fifteen?
  when "sixteen?"
    sig(args)
    code_sixteen?
  when "seventeen?"
    sig(args)
    code_seventeen?
  when "eighteen?"
    sig(args)
    code_eighteen?
  when "nineteen?"
    sig(args)
    code_nineteen?
  when "twenty?"
    sig(args)
    code_twenty?
  when "twenty_one?"
    sig(args)
    code_twenty_one?
  when "twenty_two?"
    sig(args)
    code_twenty_two?
  when "twenty_three?"
    sig(args)
    code_twenty_three?
  when "twenty_four?"
    sig(args)
    code_twenty_four?
  when "twenty_five?"
    sig(args)
    code_twenty_five?
  when "twenty_six?"
    sig(args)
    code_twenty_six?
  when "twenty_seven?"
    sig(args)
    code_twenty_seven?
  when "twenty_eight?"
    sig(args)
    code_twenty_eight?
  when "twenty_nine?"
    sig(args)
    code_twenty_nine?
  when "thirty?"
    sig(args)
    code_thirty?
  when "thirty_one?"
    sig(args)
    code_thirty_one?
  when "thirty_two?"
    sig(args)
    code_thirty_two?
  when "thirty_three?"
    sig(args)
    code_thirty_three?
  when "thirty_four?"
    sig(args)
    code_thirty_four?
  when "thirty_five?"
    sig(args)
    code_thirty_five?
  when "thirty_six?"
    sig(args)
    code_thirty_six?
  when "thirty_seven?"
    sig(args)
    code_thirty_seven?
  when "thirty_eight?"
    sig(args)
    code_thirty_eight?
  when "thirty_nine?"
    sig(args)
    code_thirty_nine?
  when "forty?"
    sig(args)
    code_forty?
  when "forty_one?"
    sig(args)
    code_forty_one?
  when "forty_two?"
    sig(args)
    code_forty_two?
  when "forty_three?"
    sig(args)
    code_forty_three?
  when "forty_four?"
    sig(args)
    code_forty_four?
  when "forty_five?"
    sig(args)
    code_forty_five?
  when "forty_six?"
    sig(args)
    code_forty_six?
  when "forty_seven?"
    sig(args)
    code_forty_seven?
  when "forty_eight?"
    sig(args)
    code_forty_eight?
  when "forty_nine?"
    sig(args)
    code_forty_nine?
  when "fifty?"
    sig(args)
    code_fifty?
  when "fifty_one?"
    sig(args)
    code_fifty_one?
  when "fifty_two?"
    sig(args)
    code_fifty_two?
  when "fifty_three?"
    sig(args)
    code_fifty_three?
  when "fifty_four?"
    sig(args)
    code_fifty_four?
  when "fifty_five?"
    sig(args)
    code_fifty_five?
  when "fifty_six?"
    sig(args)
    code_fifty_six?
  when "fifty_seven?"
    sig(args)
    code_fifty_seven?
  when "fifty_eight?"
    sig(args)
    code_fifty_eight?
  when "fifty_nine?"
    sig(args)
    code_fifty_nine?
  when "sixty?"
    sig(args)
    code_sixty?
  when "sixty_one?"
    sig(args)
    code_sixty_one?
  when "sixty_two?"
    sig(args)
    code_sixty_two?
  when "sixty_three?"
    sig(args)
    code_sixty_three?
  when "sixty_four?"
    sig(args)
    code_sixty_four?
  when "sixty_five?"
    sig(args)
    code_sixty_five?
  when "sixty_six?"
    sig(args)
    code_sixty_six?
  when "sixty_seven?"
    sig(args)
    code_sixty_seven?
  when "sixty_eight?"
    sig(args)
    code_sixty_eight?
  when "sixty_nine?"
    sig(args)
    code_sixty_nine?
  when "seventy?"
    sig(args)
    code_seventy?
  when "seventy_one?"
    sig(args)
    code_seventy_one?
  when "seventy_two?"
    sig(args)
    code_seventy_two?
  when "seventy_three?"
    sig(args)
    code_seventy_three?
  when "seventy_four?"
    sig(args)
    code_seventy_four?
  when "seventy_five?"
    sig(args)
    code_seventy_five?
  when "seventy_six?"
    sig(args)
    code_seventy_six?
  when "seventy_seven?"
    sig(args)
    code_seventy_seven?
  when "seventy_eight?"
    sig(args)
    code_seventy_eight?
  when "seventy_nine?"
    sig(args)
    code_seventy_nine?
  when "eighty?"
    sig(args)
    code_eighty?
  when "eighty_one?"
    sig(args)
    code_eighty_one?
  when "eighty_two?"
    sig(args)
    code_eighty_two?
  when "eighty_three?"
    sig(args)
    code_eighty_three?
  when "eighty_four?"
    sig(args)
    code_eighty_four?
  when "eighty_five?"
    sig(args)
    code_eighty_five?
  when "eighty_six?"
    sig(args)
    code_eighty_six?
  when "eighty_seven?"
    sig(args)
    code_eighty_seven?
  when "eighty_eight?"
    sig(args)
    code_eighty_eight?
  when "eighty_nine?"
    sig(args)
    code_eighty_nine?
  when "ninety?"
    sig(args)
    code_ninety?
  when "ninety_one?"
    sig(args)
    code_ninety_one?
  when "ninety_two?"
    sig(args)
    code_ninety_two?
  when "ninety_three?"
    sig(args)
    code_ninety_three?
  when "ninety_four?"
    sig(args)
    code_ninety_four?
  when "ninety_five?"
    sig(args)
    code_ninety_five?
  when "ninety_six?"
    sig(args)
    code_ninety_six?
  when "ninety_seven?"
    sig(args)
    code_ninety_seven?
  when "ninety_eight?"
    sig(args)
    code_ninety_eight?
  when "ninety_nine?"
    sig(args)
    code_ninety_nine?
  when "one_hundred?"
    sig(args)
    code_one_hundred?
  else
    super
  end
end

#code_all?(argument = nil, **globals) ⇒ Boolean

Returns:



1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
# File 'lib/code/object/list.rb', line 1507

def code_all?(argument = nil, **globals)
  code_argument = argument.to_code

  index = 0

  Boolean.new(
    raw.all? do |code_element|
      if code_argument.is_a?(Function)
        code_argument
          .call(
            arguments: List.new([code_element, Integer.new(index), self]),
            **globals
          )
          .truthy?
          .tap { index += 1 }
      elsif code_argument.is_a?(Class)
        code_element.is_a?(code_argument.raw).tap { index += 1 }
      else
        true.tap { index += 1 }
      end
    rescue Error::Next => e
      e.code_value.truthy?.tap { index += 1 }
    end
  )
rescue Error::Break => e
  e.code_value
end

#code_any?(argument = nil, **globals) ⇒ Boolean

Returns:



849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
# File 'lib/code/object/list.rb', line 849

def code_any?(argument = nil, **globals)
  code_argument = argument.to_code

  index = 0

  Boolean.new(
    raw.any? do |code_element|
      if code_argument.is_a?(Function)
        code_argument
          .call(
            arguments: List.new([code_element, Integer.new(index), self]),
            **globals
          )
          .truthy?
          .tap { index += 1 }
      elsif code_argument.is_a?(Class)
        code_element.is_a?(code_argument.raw).tap { index += 1 }
      else
        true.tap { index += 1 }
      end
    rescue Error::Next => e
      e.code_value.tap { index += 1 }
    end
  )
rescue Error::Break => e
  e.code_value
end

#code_append(other) ⇒ Object



877
878
879
880
881
882
883
# File 'lib/code/object/list.rb', line 877

def code_append(other)
  code_other = other.to_code

  raw << code_other

  self
end

#code_compact(argument = nil, **globals) ⇒ Object



1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
# File 'lib/code/object/list.rb', line 1563

def code_compact(argument = nil, **globals)
  code_argument = argument.to_code

  List.new(
    raw.reject.with_index do |code_element, index|
      if code_argument.nothing?
        code_element.nothing?
      elsif code_argument.is_a?(Function)
        code_argument.call(
          arguments: List.new([code_element, Integer.new(index), self]),
          **globals
        ).truthy?
      elsif code_argument.is_a?(Class)
        code_element.is_a?(code_argument.raw)
      else
        false
      end
    rescue Error::Next => e
      e.code_value.truthy?
    end
  )
rescue Error::Break => e
  e.code_value
end

#code_compact!(argument = nil, **globals) ⇒ Object



1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
# File 'lib/code/object/list.rb', line 1588

def code_compact!(argument = nil, **globals)
  code_argument = argument.to_code

  raw.reject!.with_index do |code_element, index|
    if code_argument.nothing?
      code_element.nothing?
    elsif code_argument.is_a?(Function)
      code_argument.call(
        arguments: List.new([code_element, Integer.new(index), self]),
        **globals
      ).truthy?
    elsif code_argument.is_a?(Class)
      code_element.is_a?(code_argument.raw)
    else
      false
    end
  rescue Error::Next => e
    e.code_value.truthy?
  end

  self
rescue Error::Break => e
  e.code_value
end

#code_deep_duplicateObject



1773
1774
1775
# File 'lib/code/object/list.rb', line 1773

def code_deep_duplicate
  List.new(raw.dup.map(&:code_deep_duplicate))
end

#code_detect(argument = nil, **globals) ⇒ Object



897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
# File 'lib/code/object/list.rb', line 897

def code_detect(argument = nil, **globals)
  code_argument = argument.to_code

  raw.detect.with_index do |code_element, index|
    if code_argument.is_a?(Function)
      code_argument.call(
        arguments: List.new([code_element, Integer.new(index), self]),
        **globals
      ).truthy?
    elsif code_argument.is_a?(Class)
      code_element.is_a?(code_argument.raw)
    else
      false
    end
  rescue Error::Next => e
    e.code_value
  end || Nothing.new
rescue Error::Break => e
  e.code_value
end

#code_each(argument = nil, **globals) ⇒ Object



918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
# File 'lib/code/object/list.rb', line 918

def code_each(argument = nil, **globals)
  code_argument = argument.to_code

  raw.each.with_index do |code_element, index|
    if code_argument.is_a?(Function)
      code_argument.call(
        arguments: List.new([code_element, Integer.new(index), self]),
        **globals
      )
    elsif code_argument.is_a?(Class)
      code_argument.raw.new(code_element)
    end
  rescue Error::Next => e
    e.code_value
  end

  self
rescue Error::Break => e
  e.code_value
end

#code_eighteenthObject



1017
1018
1019
# File 'lib/code/object/list.rb', line 1017

def code_eighteenth
  code_nth(17)
end

#code_eighthObject



977
978
979
# File 'lib/code/object/list.rb', line 977

def code_eighth
  code_nth(7)
end

#code_eightiethObject



1265
1266
1267
# File 'lib/code/object/list.rb', line 1265

def code_eightieth
  code_nth(79)
end

#code_eighty_eighthObject



1297
1298
1299
# File 'lib/code/object/list.rb', line 1297

def code_eighty_eighth
  code_nth(87)
end

#code_eighty_fifthObject



1285
1286
1287
# File 'lib/code/object/list.rb', line 1285

def code_eighty_fifth
  code_nth(84)
end

#code_eighty_firstObject



1269
1270
1271
# File 'lib/code/object/list.rb', line 1269

def code_eighty_first
  code_nth(80)
end

#code_eighty_fourthObject



1281
1282
1283
# File 'lib/code/object/list.rb', line 1281

def code_eighty_fourth
  code_nth(83)
end

#code_eighty_ninthObject



1301
1302
1303
# File 'lib/code/object/list.rb', line 1301

def code_eighty_ninth
  code_nth(88)
end

#code_eighty_secondObject



1273
1274
1275
# File 'lib/code/object/list.rb', line 1273

def code_eighty_second
  code_nth(81)
end

#code_eighty_seventhObject



1293
1294
1295
# File 'lib/code/object/list.rb', line 1293

def code_eighty_seventh
  code_nth(86)
end

#code_eighty_sixthObject



1289
1290
1291
# File 'lib/code/object/list.rb', line 1289

def code_eighty_sixth
  code_nth(85)
end

#code_eighty_thirdObject



1277
1278
1279
# File 'lib/code/object/list.rb', line 1277

def code_eighty_third
  code_nth(82)
end

#code_eleventhObject



989
990
991
# File 'lib/code/object/list.rb', line 989

def code_eleventh
  code_nth(10)
end

#code_fetch(key) ⇒ Object



1790
1791
1792
1793
1794
# File 'lib/code/object/list.rb', line 1790

def code_fetch(key)
  code_key = key.to_code.code_to_integer

  raw.fetch(code_key.raw, Nothing.new)
end

#code_fifteenthObject



1005
1006
1007
# File 'lib/code/object/list.rb', line 1005

def code_fifteenth
  code_nth(14)
end

#code_fifthObject



965
966
967
# File 'lib/code/object/list.rb', line 965

def code_fifth
  code_nth(4)
end

#code_fiftiethObject



1145
1146
1147
# File 'lib/code/object/list.rb', line 1145

def code_fiftieth
  code_nth(49)
end

#code_fifty_eighthObject



1177
1178
1179
# File 'lib/code/object/list.rb', line 1177

def code_fifty_eighth
  code_nth(57)
end

#code_fifty_fifthObject



1165
1166
1167
# File 'lib/code/object/list.rb', line 1165

def code_fifty_fifth
  code_nth(54)
end

#code_fifty_firstObject



1149
1150
1151
# File 'lib/code/object/list.rb', line 1149

def code_fifty_first
  code_nth(50)
end

#code_fifty_fourthObject



1161
1162
1163
# File 'lib/code/object/list.rb', line 1161

def code_fifty_fourth
  code_nth(53)
end

#code_fifty_ninthObject



1181
1182
1183
# File 'lib/code/object/list.rb', line 1181

def code_fifty_ninth
  code_nth(58)
end

#code_fifty_secondObject



1153
1154
1155
# File 'lib/code/object/list.rb', line 1153

def code_fifty_second
  code_nth(51)
end

#code_fifty_seventhObject



1173
1174
1175
# File 'lib/code/object/list.rb', line 1173

def code_fifty_seventh
  code_nth(56)
end

#code_fifty_sixthObject



1169
1170
1171
# File 'lib/code/object/list.rb', line 1169

def code_fifty_sixth
  code_nth(55)
end

#code_fifty_thirdObject



1157
1158
1159
# File 'lib/code/object/list.rb', line 1157

def code_fifty_third
  code_nth(52)
end

#code_first(value = nil) ⇒ Object



939
940
941
942
943
944
945
946
947
# File 'lib/code/object/list.rb', line 939

def code_first(value = nil)
  code_value = value.to_code

  if code_value.nothing?
    raw.first || Nothing.new
  else
    List.new(raw.first(code_value.raw))
  end
end

#code_flatten(level = nil) ⇒ Object



1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
# File 'lib/code/object/list.rb', line 1363

def code_flatten(level = nil)
  code_level = level.to_code
  code_level = Integer.new(-1) if code_level.nothing?
  level = code_level.raw

  List.new(
    raw.reduce([]) do |acc, code_element|
      if code_element.is_a?(List) && level != 0
        if level.positive?
          acc + code_element.code_flatten(level - 1).raw
        else
          acc + code_element.code_flatten(level).raw
        end
      else
        acc + [code_element]
      end
    end
  )
end

#code_fortiethObject



1105
1106
1107
# File 'lib/code/object/list.rb', line 1105

def code_fortieth
  code_nth(39)
end

#code_forty_eighthObject



1137
1138
1139
# File 'lib/code/object/list.rb', line 1137

def code_forty_eighth
  code_nth(47)
end

#code_forty_fifthObject



1125
1126
1127
# File 'lib/code/object/list.rb', line 1125

def code_forty_fifth
  code_nth(44)
end

#code_forty_firstObject



1109
1110
1111
# File 'lib/code/object/list.rb', line 1109

def code_forty_first
  code_nth(40)
end

#code_forty_fourthObject



1121
1122
1123
# File 'lib/code/object/list.rb', line 1121

def code_forty_fourth
  code_nth(43)
end

#code_forty_ninthObject



1141
1142
1143
# File 'lib/code/object/list.rb', line 1141

def code_forty_ninth
  code_nth(48)
end

#code_forty_secondObject



1113
1114
1115
# File 'lib/code/object/list.rb', line 1113

def code_forty_second
  code_nth(41)
end

#code_forty_seventhObject



1133
1134
1135
# File 'lib/code/object/list.rb', line 1133

def code_forty_seventh
  code_nth(46)
end

#code_forty_sixthObject



1129
1130
1131
# File 'lib/code/object/list.rb', line 1129

def code_forty_sixth
  code_nth(45)
end

#code_forty_thirdObject



1117
1118
1119
# File 'lib/code/object/list.rb', line 1117

def code_forty_third
  code_nth(42)
end

#code_fourteenthObject



1001
1002
1003
# File 'lib/code/object/list.rb', line 1001

def code_fourteenth
  code_nth(13)
end

#code_fourthObject



961
962
963
# File 'lib/code/object/list.rb', line 961

def code_fourth
  code_nth(3)
end

#code_get(argument) ⇒ Object



1777
1778
1779
1780
1781
# File 'lib/code/object/list.rb', line 1777

def code_get(argument)
  code_argument = argument.to_code

  raw[code_argument.raw] || Nothing.new
end

#code_include?(other) ⇒ Boolean

Returns:



1404
1405
1406
1407
1408
# File 'lib/code/object/list.rb', line 1404

def code_include?(other)
  code_other = other.to_code

  Boolean.new(raw.include?(code_other))
end

#code_join(separator = nil) ⇒ Object



1705
1706
1707
1708
1709
# File 'lib/code/object/list.rb', line 1705

def code_join(separator = nil)
  code_separator = separator.to_s.to_code

  String.new(raw.join(code_separator.raw))
end

#code_lastObject



1410
1411
1412
# File 'lib/code/object/list.rb', line 1410

def code_last
  raw.last || Nothing.new
end

#code_map(argument = nil, **globals) ⇒ Object



1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
# File 'lib/code/object/list.rb', line 1414

def code_map(argument = nil, **globals)
  code_argument = argument.to_code

  List.new(
    raw.map.with_index do |code_element, index|
      if code_argument.is_a?(Function)
        code_argument.call(
          arguments: List.new([code_element, Integer.new(index), self]),
          **globals
        )
      elsif code_argument.is_a?(Class)
        code_argument.raw.new(code_element)
      else
        Nothing.new
      end
    rescue Error::Next => e
      e.code_value
    end
  )
rescue Error::Break => e
  e.code_value
end

#code_map!(argument = nil, **globals) ⇒ Object



1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
# File 'lib/code/object/list.rb', line 1437

def code_map!(argument = nil, **globals)
  code_argument = argument.to_code

  raw.map!.with_index do |code_element, index|
    if code_argument.is_a?(Function)
      code_argument.call(
        arguments: List.new([code_element, Integer.new(index), self]),
        **globals
      )
    elsif code_argument.is_a?(Class)
      code_argument.raw.new(code_element)
    else
      Nothing.new
    end
  rescue Error::Next => e
    e.code_value
  end

  self
rescue Error::Break => e
  e.code_value
end

#code_max(argument = nil, **globals) ⇒ Object



1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
# File 'lib/code/object/list.rb', line 1460

def code_max(argument = nil, **globals)
  code_argument = argument.to_code

  raw.max_by.with_index do |code_element, index|
    if code_argument.is_a?(Function)
      code_argument.call(
        arguments: List.new([code_element, Integer.new(index), self]),
        **globals
      ).truthy?
    else
      code_element
    end
  rescue Error::Next => e
    e.code_value
  end || Nothing.new
rescue Error::Break => e
  e.code_value
end

#code_minus(other) ⇒ Object



891
892
893
894
895
# File 'lib/code/object/list.rb', line 891

def code_minus(other)
  code_other = other.to_code

  List.new(raw - code_other.raw)
end

#code_nineteenthObject



1021
1022
1023
# File 'lib/code/object/list.rb', line 1021

def code_nineteenth
  code_nth(18)
end

#code_ninetiethObject



1305
1306
1307
# File 'lib/code/object/list.rb', line 1305

def code_ninetieth
  code_nth(89)
end

#code_ninety_eighthObject



1337
1338
1339
# File 'lib/code/object/list.rb', line 1337

def code_ninety_eighth
  code_nth(97)
end

#code_ninety_fifthObject



1325
1326
1327
# File 'lib/code/object/list.rb', line 1325

def code_ninety_fifth
  code_nth(94)
end

#code_ninety_firstObject



1309
1310
1311
# File 'lib/code/object/list.rb', line 1309

def code_ninety_first
  code_nth(90)
end

#code_ninety_fourthObject



1321
1322
1323
# File 'lib/code/object/list.rb', line 1321

def code_ninety_fourth
  code_nth(93)
end

#code_ninety_ninthObject



1341
1342
1343
# File 'lib/code/object/list.rb', line 1341

def code_ninety_ninth
  code_nth(98)
end

#code_ninety_secondObject



1313
1314
1315
# File 'lib/code/object/list.rb', line 1313

def code_ninety_second
  code_nth(91)
end

#code_ninety_seventhObject



1333
1334
1335
# File 'lib/code/object/list.rb', line 1333

def code_ninety_seventh
  code_nth(96)
end

#code_ninety_sixthObject



1329
1330
1331
# File 'lib/code/object/list.rb', line 1329

def code_ninety_sixth
  code_nth(95)
end

#code_ninety_thirdObject



1317
1318
1319
# File 'lib/code/object/list.rb', line 1317

def code_ninety_third
  code_nth(92)
end

#code_ninthObject



981
982
983
# File 'lib/code/object/list.rb', line 981

def code_ninth
  code_nth(8)
end

#code_none?(argument = nil, **globals) ⇒ Boolean

Returns:



1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
# File 'lib/code/object/list.rb', line 1479

def code_none?(argument = nil, **globals)
  code_argument = argument.to_code

  index = 0

  Boolean.new(
    raw.none? do |code_element|
      if code_argument.is_a?(Function)
        code_argument
          .call(
            arguments: List.new([code_element, Integer.new(index), self]),
            **globals
          )
          .truthy?
          .tap { index += 1 }
      elsif code_argument.is_a?(Class)
        code_element.is_a?(code_argument.raw).tap { index += 1 }
      else
        true.tap { index += 1 }
      end
    rescue Error::Next => e
      e.code_value.truthy?.tap { index += 1 }
    end
  )
rescue Error::Break => e
  e.code_value
end

#code_nth(index) ⇒ Object



949
950
951
# File 'lib/code/object/list.rb', line 949

def code_nth(index)
  raw[index] || Nothing.new
end

#code_one_hundredthObject



1345
1346
1347
# File 'lib/code/object/list.rb', line 1345

def code_one_hundredth
  code_nth(99)
end

#code_plus(other) ⇒ Object



885
886
887
888
889
# File 'lib/code/object/list.rb', line 885

def code_plus(other)
  code_other = other.to_code

  List.new(raw + code_other.raw)
end

#code_pop(n = nil) ⇒ Object



1383
1384
1385
1386
1387
1388
# File 'lib/code/object/list.rb', line 1383

def code_pop(n = nil)
  code_n = n.to_code
  n = code_n.raw

  code_n.nothing? ? raw.dup.pop || Nothing.new : List.new(raw.dup.pop(n))
end

#code_pop!(n = nil) ⇒ Object



1390
1391
1392
1393
1394
1395
# File 'lib/code/object/list.rb', line 1390

def code_pop!(n = nil)
  code_n = n.to_code
  n = code_n.raw

  code_n.nothing? ? raw.pop || Nothing.new : List.new(raw.pop(n))
end

#code_reduce(argument = nil, **globals) ⇒ Object



1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
# File 'lib/code/object/list.rb', line 1535

def code_reduce(argument = nil, **globals)
  code_argument = argument.to_code

  index = 0

  raw.reduce do |code_acc, code_element|
    if code_argument.is_a?(Function)
      code_argument
        .call(
          arguments:
            List.new([code_acc, code_element, Integer.new(index), self]),
          **globals
        )
        .tap { index += 1 }
    else
      code_acc.tap { index += 1 }
    end
  rescue Error::Next => e
    e.code_value.tap { index += 1 }
  end || Nothing.new
rescue Error::Break => e
  e.code_value
end

#code_reject(argument = nil, **globals) ⇒ Object



1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
# File 'lib/code/object/list.rb', line 1659

def code_reject(argument = nil, **globals)
  code_argument = argument.to_code

  List.new(
    raw.reject.with_index do |code_element, index|
      if code_argument.is_a?(Function)
        code_argument.call(
          arguments: List.new([code_element, Integer.new(index), self]),
          **globals
        ).truthy?
      elsif code_argument.is_a?(Class)
        code_element.is_a?(code_argument.raw)
      else
        false
      end
    rescue Error::Next => e
      e.code_value.truthy?
    end
  )
rescue Error::Break => e
  e.code_value
end

#code_reject!(argument = nil, **globals) ⇒ Object



1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
# File 'lib/code/object/list.rb', line 1682

def code_reject!(argument = nil, **globals)
  code_argument = argument.to_code

  raw.reject!.with_index do |code_element, index|
    if code_argument.is_a?(Function)
      code_argument.call(
        arguments: List.new([code_element, Integer.new(index), self]),
        **globals
      ).truthy?
    elsif code_argument.is_a?(Class)
      code_element.is_a?(code_argument.raw)
    else
      false
    end
  rescue Error::Next => e
    e.code_value.truthy?
  end

  self
rescue Error::Break => e
  e.code_value
end

#code_reverseObject



1559
1560
1561
# File 'lib/code/object/list.rb', line 1559

def code_reverse
  List.new(raw.reverse)
end

#code_sample(value = nil) ⇒ Object



1349
1350
1351
1352
1353
1354
1355
1356
1357
# File 'lib/code/object/list.rb', line 1349

def code_sample(value = nil)
  code_value = value.to_code

  if code_value.nothing?
    raw.sample || Nothing.new
  else
    List.new(raw.sample(code_value.raw))
  end
end

#code_secondObject



953
954
955
# File 'lib/code/object/list.rb', line 953

def code_second
  code_nth(1)
end

#code_select(argument = nil, **globals) ⇒ Object



1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
# File 'lib/code/object/list.rb', line 1613

def code_select(argument = nil, **globals)
  code_argument = argument.to_code

  List.new(
    raw.select.with_index do |code_element, index|
      if code_argument.is_a?(Function)
        code_argument.call(
          arguments: List.new([code_element, Integer.new(index), self]),
          **globals
        ).truthy?
      elsif code_argument.is_a?(Class)
        code_element.is_a?(code_argument.raw)
      else
        false
      end
    rescue Error::Next => e
      e.code_value.truthy?
    end
  )
rescue Error::Break => e
  e.code_value
end

#code_select!(argument = nil, **globals) ⇒ Object



1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
# File 'lib/code/object/list.rb', line 1636

def code_select!(argument = nil, **globals)
  code_argument = argument.to_code

  raw.select!.with_index do |code_element, index|
    if code_argument.is_a?(Function)
      code_argument.call(
        arguments: List.new([code_element, Integer.new(index), self]),
        **globals
      ).truthy?
    elsif code_argument.is_a?(Class)
      code_element.is_a?(code_argument.raw)
    else
      false
    end
  rescue Error::Next => e
    e.code_value.truthy?
  end

  self
rescue Error::Break => e
  e.code_value
end

#code_set(key, value) ⇒ Object



1783
1784
1785
1786
1787
1788
# File 'lib/code/object/list.rb', line 1783

def code_set(key, value)
  code_key = key.to_code.code_to_integer
  code_value = value.to_code
  raw[code_key.raw] = code_value
  code_value
end

#code_seventeenthObject



1013
1014
1015
# File 'lib/code/object/list.rb', line 1013

def code_seventeenth
  code_nth(16)
end

#code_seventhObject



973
974
975
# File 'lib/code/object/list.rb', line 973

def code_seventh
  code_nth(6)
end

#code_seventiethObject



1225
1226
1227
# File 'lib/code/object/list.rb', line 1225

def code_seventieth
  code_nth(69)
end

#code_seventy_eighthObject



1257
1258
1259
# File 'lib/code/object/list.rb', line 1257

def code_seventy_eighth
  code_nth(77)
end

#code_seventy_fifthObject



1245
1246
1247
# File 'lib/code/object/list.rb', line 1245

def code_seventy_fifth
  code_nth(74)
end

#code_seventy_firstObject



1229
1230
1231
# File 'lib/code/object/list.rb', line 1229

def code_seventy_first
  code_nth(70)
end

#code_seventy_fourthObject



1241
1242
1243
# File 'lib/code/object/list.rb', line 1241

def code_seventy_fourth
  code_nth(73)
end

#code_seventy_ninthObject



1261
1262
1263
# File 'lib/code/object/list.rb', line 1261

def code_seventy_ninth
  code_nth(78)
end

#code_seventy_secondObject



1233
1234
1235
# File 'lib/code/object/list.rb', line 1233

def code_seventy_second
  code_nth(71)
end

#code_seventy_seventhObject



1253
1254
1255
# File 'lib/code/object/list.rb', line 1253

def code_seventy_seventh
  code_nth(76)
end

#code_seventy_sixthObject



1249
1250
1251
# File 'lib/code/object/list.rb', line 1249

def code_seventy_sixth
  code_nth(75)
end

#code_seventy_thirdObject



1237
1238
1239
# File 'lib/code/object/list.rb', line 1237

def code_seventy_third
  code_nth(72)
end

#code_shift(n = nil) ⇒ Object



1397
1398
1399
1400
1401
1402
# File 'lib/code/object/list.rb', line 1397

def code_shift(n = nil)
  code_n = n.to_code
  n = code_n.raw

  code_n.nothing? ? raw.shift || Nothing.new : List.new(raw.shift(n))
end

#code_shuffleObject



1359
1360
1361
# File 'lib/code/object/list.rb', line 1359

def code_shuffle
  List.new(raw.shuffle)
end

#code_sixteenthObject



1009
1010
1011
# File 'lib/code/object/list.rb', line 1009

def code_sixteenth
  code_nth(15)
end

#code_sixthObject



969
970
971
# File 'lib/code/object/list.rb', line 969

def code_sixth
  code_nth(5)
end

#code_sixtiethObject



1185
1186
1187
# File 'lib/code/object/list.rb', line 1185

def code_sixtieth
  code_nth(59)
end

#code_sixty_eighthObject



1217
1218
1219
# File 'lib/code/object/list.rb', line 1217

def code_sixty_eighth
  code_nth(67)
end

#code_sixty_fifthObject



1205
1206
1207
# File 'lib/code/object/list.rb', line 1205

def code_sixty_fifth
  code_nth(64)
end

#code_sixty_firstObject



1189
1190
1191
# File 'lib/code/object/list.rb', line 1189

def code_sixty_first
  code_nth(60)
end

#code_sixty_fourthObject



1201
1202
1203
# File 'lib/code/object/list.rb', line 1201

def code_sixty_fourth
  code_nth(63)
end

#code_sixty_ninthObject



1221
1222
1223
# File 'lib/code/object/list.rb', line 1221

def code_sixty_ninth
  code_nth(68)
end

#code_sixty_secondObject



1193
1194
1195
# File 'lib/code/object/list.rb', line 1193

def code_sixty_second
  code_nth(61)
end

#code_sixty_seventhObject



1213
1214
1215
# File 'lib/code/object/list.rb', line 1213

def code_sixty_seventh
  code_nth(66)
end

#code_sixty_sixthObject



1209
1210
1211
# File 'lib/code/object/list.rb', line 1209

def code_sixty_sixth
  code_nth(65)
end

#code_sixty_thirdObject



1197
1198
1199
# File 'lib/code/object/list.rb', line 1197

def code_sixty_third
  code_nth(62)
end

#code_sizeObject



1732
1733
1734
# File 'lib/code/object/list.rb', line 1732

def code_size
  Integer.new(raw.size)
end

#code_sort(argument = nil, **globals) ⇒ Object



1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
# File 'lib/code/object/list.rb', line 1711

def code_sort(argument = nil, **globals)
  code_argument = argument.to_code

  List.new(
    raw.sort_by.with_index do |code_element, index|
      if code_argument.is_a?(Function)
        code_argument.call(
          arguments: List.new([code_element, Integer.new(index), self]),
          **globals
        )
      else
        code_element
      end
    rescue Error::Next => e
      e.code_value
    end
  )
rescue Error::Break => e
  e.code_value
end

#code_sumObject



1769
1770
1771
# File 'lib/code/object/list.rb', line 1769

def code_sum
  raw.inject(&:code_plus) || Nothing.new
end

#code_tenthObject



985
986
987
# File 'lib/code/object/list.rb', line 985

def code_tenth
  code_nth(9)
end

#code_thirdObject



957
958
959
# File 'lib/code/object/list.rb', line 957

def code_third
  code_nth(2)
end

#code_thirteenthObject



997
998
999
# File 'lib/code/object/list.rb', line 997

def code_thirteenth
  code_nth(12)
end

#code_thirtiethObject



1065
1066
1067
# File 'lib/code/object/list.rb', line 1065

def code_thirtieth
  code_nth(29)
end

#code_thirty_eighthObject



1097
1098
1099
# File 'lib/code/object/list.rb', line 1097

def code_thirty_eighth
  code_nth(37)
end

#code_thirty_fifthObject



1085
1086
1087
# File 'lib/code/object/list.rb', line 1085

def code_thirty_fifth
  code_nth(34)
end

#code_thirty_firstObject



1069
1070
1071
# File 'lib/code/object/list.rb', line 1069

def code_thirty_first
  code_nth(30)
end

#code_thirty_fourthObject



1081
1082
1083
# File 'lib/code/object/list.rb', line 1081

def code_thirty_fourth
  code_nth(33)
end

#code_thirty_ninthObject



1101
1102
1103
# File 'lib/code/object/list.rb', line 1101

def code_thirty_ninth
  code_nth(38)
end

#code_thirty_secondObject



1073
1074
1075
# File 'lib/code/object/list.rb', line 1073

def code_thirty_second
  code_nth(31)
end

#code_thirty_seventhObject



1093
1094
1095
# File 'lib/code/object/list.rb', line 1093

def code_thirty_seventh
  code_nth(36)
end

#code_thirty_sixthObject



1089
1090
1091
# File 'lib/code/object/list.rb', line 1089

def code_thirty_sixth
  code_nth(35)
end

#code_thirty_thirdObject



1077
1078
1079
# File 'lib/code/object/list.rb', line 1077

def code_thirty_third
  code_nth(32)
end

#code_twelfthObject



993
994
995
# File 'lib/code/object/list.rb', line 993

def code_twelfth
  code_nth(11)
end

#code_twentiethObject



1025
1026
1027
# File 'lib/code/object/list.rb', line 1025

def code_twentieth
  code_nth(19)
end

#code_twenty_eighthObject



1057
1058
1059
# File 'lib/code/object/list.rb', line 1057

def code_twenty_eighth
  code_nth(27)
end

#code_twenty_fifthObject



1045
1046
1047
# File 'lib/code/object/list.rb', line 1045

def code_twenty_fifth
  code_nth(24)
end

#code_twenty_firstObject



1029
1030
1031
# File 'lib/code/object/list.rb', line 1029

def code_twenty_first
  code_nth(20)
end

#code_twenty_fourthObject



1041
1042
1043
# File 'lib/code/object/list.rb', line 1041

def code_twenty_fourth
  code_nth(23)
end

#code_twenty_ninthObject



1061
1062
1063
# File 'lib/code/object/list.rb', line 1061

def code_twenty_ninth
  code_nth(28)
end

#code_twenty_secondObject



1033
1034
1035
# File 'lib/code/object/list.rb', line 1033

def code_twenty_second
  code_nth(21)
end

#code_twenty_seventhObject



1053
1054
1055
# File 'lib/code/object/list.rb', line 1053

def code_twenty_seventh
  code_nth(26)
end

#code_twenty_sixthObject



1049
1050
1051
# File 'lib/code/object/list.rb', line 1049

def code_twenty_sixth
  code_nth(25)
end

#code_twenty_thirdObject



1037
1038
1039
# File 'lib/code/object/list.rb', line 1037

def code_twenty_third
  code_nth(22)
end

#code_uniq(argument = nil, **globals) ⇒ Object



1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
# File 'lib/code/object/list.rb', line 1736

def code_uniq(argument = nil, **globals)
  code_argument = argument.to_code

  unless code_argument.is_a?(Function) || code_argument.is_a?(Class)
    return List.new(raw.uniq)
  end

  if code_argument.is_a?(Class)
    return List.new(raw.grep(code_argument.raw).uniq)
  end

  index = 0

  List.new(
    raw.uniq do |code_element|
      if code_argument.is_a?(Function)
        code_argument
          .call(
            arguments: List.new([code_element, Integer.new(index), self]),
            **globals
          )
          .tap { index += 1 }
      else
        code_element.tap { index += 1 }
      end
    rescue Error::Next => e
      e.code_value.tap { index += 1 }
    end
  )
rescue Error::Break => e
  e.code_value
end

#present?Boolean

Returns:



1800
1801
1802
# File 'lib/code/object/list.rb', line 1800

def present?
  raw.present?
end