File: list.texi

package info (click to toggle)
gcl27 2.7.1-13
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 30,888 kB
  • sloc: lisp: 211,946; ansic: 52,944; sh: 9,347; makefile: 647; tcl: 53; awk: 52
file content (899 lines) | stat: -rwxr-xr-x 13,072 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
848
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
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
@node Lists, Streams and Reading, Characters, Top
@chapter Lists

@defun NINTERSECTION (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the intersection of LIST1 and LIST2.  LIST1 may be destroyed.


@end defun

@defun RASSOC-IF (predicate alist)
Package:LISP

Returns the first cons in ALIST whose cdr satisfies PREDICATE.


@end defun

@defun MAKE-LIST (size &key (initial-element nil))
Package:LISP

Creates and returns a list containing SIZE elements, each of which is
initialized to INITIAL-ELEMENT.


@end defun

@defun NTH (n list)
Package:LISP

Returns the N-th element of LIST, where the car of LIST is the zeroth
element.


@end defun

@defun CAAR (x)
Package:LISP

Equivalent to (CAR (CAR X)).


@end defun

@defun NULL (x)
Package:LISP

Returns T if X is NIL; NIL otherwise.


@end defun

@defun FIFTH (x)
Package:LISP

Equivalent to (CAR (CDDDDR X)).


@end defun

@defun NCONC (&rest lists)
Package:LISP

Concatenates LISTs by destructively modifying them.


@end defun

@defun TAILP (sublist list)
Package:LISP

Returns T if SUBLIST is one of the conses in LIST; NIL otherwise.


@end defun

@defun CONSP (x)
Package:LISP

Returns T if X is a cons; NIL otherwise.


@end defun

@defun TENTH (x)
Package:LISP

Equivalent to (CADR (CDDDDR (CDDDDR X))).


@end defun

@defun LISTP (x)
Package:LISP

Returns T if X is either a cons or NIL; NIL otherwise.


@end defun

@defun MAPCAN (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cars of LISTs, NCONCs the results, and returns it.


@end defun

@defun EIGHTH (x)
Package:LISP

Equivalent to (CADDDR (CDDDDR X)).


@end defun

@defun LENGTH (sequence)
Package:LISP

Returns the length of SEQUENCE.


@end defun

@defun RASSOC (item alist &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the first cons in ALIST whose cdr is equal to ITEM.


@end defun

@defun NSUBST-IF-NOT (new test tree &key (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that do not satisfy TEST.


@end defun

@defun NBUTLAST (list &optional (n 1))
Package:LISP

Changes the cdr of the N+1 th cons from the end of the list LIST to NIL.
Returns the whole list.


@end defun



@defun CDR (list)
Package:LISP

Returns the cdr of LIST.  Returns NIL if LIST is NIL.


@end defun

@defun MAPC (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cars of LISTs.  Returns the first LIST.


@end defun

@defun MAPL (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cdrs of LISTs.  Returns the first LIST.


@end defun

@defun CONS (x y)
Package:LISP

Returns a new cons whose car and cdr are X and Y, respectively.


@end defun

@defun LIST (&rest args)
Package:LISP

Returns a list of its arguments


@end defun


@defun THIRD (x)
Package:LISP

Equivalent to (CADDR X).


@end defun

@defun CDDAAR (x)
Package:LISP

Equivalent to (CDR (CDR (CAR (CAR X)))).


@end defun

@defun CDADAR (x)
Package:LISP

Equivalent to (CDR (CAR (CDR (CAR X)))).


@end defun

@defun CDAADR (x)
Package:LISP

Equivalent to (CDR (CAR (CAR (CDR X)))).


@end defun

@defun CADDAR (x)
Package:LISP

Equivalent to (CAR (CDR (CDR (CAR X)))).


@end defun

@defun CADADR (x)
Package:LISP

Equivalent to (CAR (CDR (CAR (CDR X)))).


@end defun

@defun CAADDR (x)
Package:LISP

Equivalent to (CAR (CAR (CDR (CDR X)))).


@end defun

@defun NTHCDR (n list)
Package:LISP

Returns the result of performing the CDR operation N times on LIST.


@end defun

@defun PAIRLIS (keys data &optional (alist nil))
Package:LISP

Constructs an association list from KEYS and DATA adding to ALIST.


@end defun

@defun SEVENTH (x)
Package:LISP

Equivalent to (CADDR (CDDDDR X)).


@end defun

@defun SUBSETP (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns T if every element of LIST1 appears in LIST2; NIL otherwise.


@end defun

@defun NSUBST-IF (new test tree &key (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that satisfy TEST.


@end defun

@defun COPY-LIST (list)
Package:LISP

Returns a new copy of LIST.


@end defun

@defun LAST (list)
Package:LISP

Returns the last cons in LIST


@end defun

@defun CAAAR (x)
Package:LISP

Equivalent to (CAR (CAR (CAR X))).


@end defun

@defun LIST-LENGTH (list)
Package:LISP

Returns the length of LIST, or NIL if LIST is circular.


@end defun

@defun CDDDR (x)
Package:LISP

Equivalent to (CDR (CDR (CDR X))).


@end defun

@defun INTERSECTION (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the intersection of List1 and List2.


@end defun

@defun NSUBST (new old tree &key (test #'eql) test-not (key #'identity))
Package:LISP

Substitutes NEW for subtrees in TREE that match OLD.


@end defun

@defun REVAPPEND (x y)
Package:LISP

Equivalent to (APPEND (REVERSE X) Y)


@end defun

@defun CDAR (x)
Package:LISP

Equivalent to (CDR (CAR X)).


@end defun

@defun CADR (x)
Package:LISP

Equivalent to (CAR (CDR X)).


@end defun

@defun REST (x)
Package:LISP

Equivalent to (CDR X).


@end defun

@defun NSET-EXCLUSIVE-OR (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns a list with elements which appear but once in LIST1 and LIST2.


@end defun

@defun ACONS (key datum alist)
Package:LISP

Constructs a new alist by adding the pair (KEY . DATUM) to ALIST.


@end defun

@defun SUBST-IF-NOT (new test tree &key (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that do not satisfy TEST.


@end defun

@defun RPLACA (x y)
Package:LISP

Replaces the car of X with Y, and returns the modified X.


@end defun

@defun SECOND (x)
Package:LISP

Equivalent to (CADR X).


@end defun

@defun NUNION (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the union of LIST1 and LIST2.  LIST1 and/or LIST2 may be destroyed.


@end defun

@defun BUTLAST (list &optional (n 1))
Package:LISP

Creates and returns a list with the same elements as LIST but without the
last N elements.


@end defun

@defun COPY-ALIST (alist)
Package:LISP
 Returns a new copy of ALIST.


@end defun

@defun SIXTH (x)
Package:LISP
 Equivalent to (CADR (CDDDDR X)).


@end defun

@defun CAAAAR (x)
Package:LISP

Equivalent to (CAR (CAR (CAR (CAR X)))).


@end defun

@defun CDDDAR (x)
Package:LISP

Equivalent to (CDR (CDR (CDR (CAR X)))).


@end defun

@defun CDDADR (x)
Package:LISP

Equivalent to (CDR (CDR (CAR (CDR X)))).


@end defun

@defun CDADDR (x)
Package:LISP

Equivalent to (CDR (CAR (CDR (CDR X)))).


@end defun

@defun CADDDR (x)
Package:LISP

Equivalent to (CAR (CDR (CDR (CDR X)))).


@end defun

@defun FOURTH (x)
Package:LISP

Equivalent to (CADDDR X).


@end defun

@defun NSUBLIS (alist tree &key (test #'eql) test-not (key #'identity))
Package:LISP

Substitutes from ALIST for subtrees of TREE.


@end defun

@defun SUBST-IF (new test tree &key (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that satisfy TEST.


@end defun

@defun NSET-DIFFERENCE (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns a list of elements of LIST1 that do not appear in LIST2.  LIST1 may
be destroyed.


@end defun

@deffn {Special Form} POP 
Package:LISP

Syntax:
@example
(pop place)
@end example

Pops one item off the front of the list in PLACE and returns it.


@end deffn

@deffn {Special Form} PUSH 
Package:LISP

Syntax:
@example
(push item place)
@end example

Conses ITEM onto the list in PLACE, and returns the new list.


@end deffn

@defun CDAAR (x)
Package:LISP

Equivalent to (CDR (CAR (CAR X))).


@end defun

@defun CADAR (x)
Package:LISP

Equivalent to (CAR (CDR (CAR X))).


@end defun

@defun CAADR (x)
Package:LISP

Equivalent to (CAR (CAR (CDR X))).


@end defun

@defun FIRST (x)
Package:LISP

Equivalent to (CAR X).


@end defun

@defun SUBST (new old tree &key (test #'eql) test-not (key #'identity))
Package:LISP

Substitutes NEW for subtrees of TREE that match OLD.


@end defun

@defun ADJOIN (item list &key (test #'eql) test-not (key #'identity))
Package:LISP

Adds ITEM to LIST unless ITEM is already a member of LIST.


@end defun

@defun MAPCON (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cdrs of LISTs, NCONCs the results, and returns it.


@end defun

@deffn {Macro} PUSHNEW 
Package:LISP

Syntax:
@example
(pushnew item place @{keyword value@}*)
@end example

If ITEM is already in the list stored in PLACE, does nothing.  Else, conses
ITEM onto the list.  Returns NIL.  If no KEYWORDs are supplied, each element
in the list is compared with ITEM by EQL, but the comparison can be controlled
by supplying keywords :TEST, :TEST-NOT, and/or :KEY.


@end deffn

@defun SET-EXCLUSIVE-OR (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns a list of elements appearing exactly once in LIST1 and LIST2.


@end defun

@defun TREE-EQUAL (x y &key (test #'eql) test-not)
Package:LISP

Returns T if X and Y are isomorphic trees with identical leaves.


@end defun

@defun CDDR (x)
Package:LISP

Equivalent to (CDR (CDR X)).


@end defun

@defun GETF (place indicator &optional (default nil))
Package:LISP

Searches the property list stored in Place for an indicator EQ to Indicator.
If one is found, the corresponding value is returned, else the Default is
returned.


@end defun

@defun LDIFF (list sublist)
Package:LISP

Returns a new list, whose elements are those of LIST that appear before
SUBLIST.  If SUBLIST is not a tail of LIST, a copy of LIST is returned.


@end defun

@defun UNION (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the union of LIST1 and LIST2.


@end defun

@defun ASSOC-IF-NOT (test alist)
Package:LISP

Returns the first pair in ALIST whose car does not satisfy TEST.


@end defun

@defun RPLACD (x y)
Package:LISP

Replaces the cdr of X with Y, and returns the modified X.


@end defun

@defun MEMBER-IF-NOT (test list &key (key #'identity))
Package:LISP

Returns the tail of LIST beginning with the first element not satisfying
TEST.


@end defun

@defun CAR (list)
Package:LISP

Returns the car of LIST.  Returns NIL if LIST is NIL.


@end defun

@defun ENDP (x)
Package:LISP

Returns T if X is NIL.  Returns NIL if X is a cons.  Otherwise, signals an
error.


@end defun

@defun LIST* (arg &rest others)
Package:LISP

Returns a list of its arguments with the last cons being a dotted pair of
the next to the last argument and the last argument.


@end defun

@defun NINTH (x)
Package:LISP

Equivalent to (CAR (CDDDDR (CDDDDR X))).


@end defun

@defun CDAAAR (x)
Package:LISP

Equivalent to (CDR (CAR (CAR (CAR X)))).


@end defun

@defun CADAAR (x)
Package:LISP

Equivalent to (CAR (CDR (CAR (CAR X)))).


@end defun

@defun CAADAR (x)
Package:LISP

Equivalent to (CAR (CAR (CDR (CAR X)))).


@end defun

@defun CAAADR (x)
Package:LISP

Equivalent to (CAR (CAR (CAR (CDR X)))).


@end defun

@defun CDDDDR (x)
Package:LISP

Equivalent to (CDR (CDR (CDR (CDR X)))).


@end defun

@defun SUBLIS (alist tree &key (test #'eql) test-not (key #'identity))
Package:LISP

Substitutes from ALIST for subtrees of TREE nondestructively.


@end defun

@defun RASSOC-IF-NOT (predicate alist)
Package:LISP

Returns the first cons in ALIST whose cdr does not satisfy PREDICATE.


@end defun

@defun NRECONC (x y)
Package:LISP

Equivalent to (NCONC (NREVERSE X) Y).


@end defun

@defun MAPLIST (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cdrs of LISTs and returns the results as a list.


@end defun

@defun SET-DIFFERENCE (list1 list2 &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns a list of elements of LIST1 that do not appear in LIST2.


@end defun

@defun ASSOC-IF (test alist)
Package:LISP

Returns the first pair in ALIST whose car satisfies TEST.


@end defun

@defun GET-PROPERTIES (place indicator-list)
Package:LISP

Looks for the elements of INDICATOR-LIST in the property list stored in PLACE.
If found, returns the indicator, the value, and T as multiple-values.  If not,
returns NILs as its three values.


@end defun

@defun MEMBER-IF (test list &key (key #'identity))
Package:LISP

Returns the tail of LIST beginning with the first element satisfying TEST.


@end defun

@defun COPY-TREE (object)
Package:LISP

Recursively copies conses in OBJECT and returns the result.


@end defun

@defun ATOM (x)
Package:LISP

Returns T if X is not a cons; NIL otherwise.


@end defun

@defun CDDAR (x)
Package:LISP

Equivalent to (CDR (CDR (CAR X))).


@end defun

@defun CDADR (x)
Package:LISP

Equivalent to (CDR (CAR (CDR X))).


@end defun

@defun CADDR (x)
Package:LISP

Equivalent to (CAR (CDR (CDR X))).


@end defun

@defun ASSOC (item alist &key (test #'eql) test-not)
Package:LISP

Returns the first pair in ALIST whose car is equal (in the sense of TEST) to
ITEM.


@end defun

@defun APPEND (&rest lists)
Package:LISP

Constructs a new list by concatenating its arguments.


@end defun

@defun MEMBER (item list &key (test #'eql) test-not (key #'identity))
Package:LISP

Returns the tail of LIST beginning with the first ITEM.


@end defun