~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/c/list.d

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2007-04-09 11:51:51 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070409115151-ql8cr0kalzx1jmla
Tags: 0.9i-20070324-2
Upload to unstable. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
static bool
58
58
test_eql(struct cl_test *t, cl_object x)
59
59
{
60
 
        return eql(t->item_compared, (t->key_c_function)(t, x));
 
60
        return ecl_eql(t->item_compared, (t->key_c_function)(t, x));
61
61
}
62
62
 
63
63
static bool
64
64
test_equal(struct cl_test *t, cl_object x)
65
65
{
66
 
        return equal(t->item_compared, (t->key_c_function)(t, x));
 
66
        return ecl_equal(t->item_compared, (t->key_c_function)(t, x));
67
67
}
68
68
 
69
69
static bool
70
70
test_equalp(struct cl_test *t, cl_object x)
71
71
{
72
 
        return equalp(t->item_compared, (t->key_c_function)(t, x));
 
72
        return ecl_equalp(t->item_compared, (t->key_c_function)(t, x));
73
73
}
74
74
 
75
75
static cl_object
187
187
@)
188
188
 
189
189
cl_object
190
 
append(cl_object x, cl_object y)
 
190
ecl_append(cl_object x, cl_object y)
191
191
{
192
192
        cl_object w, *z;
193
193
 
252
252
#undef cdr
253
253
 
254
254
#define LENTH(n) (cl_object x) {\
255
 
        return1(nth(n, x));\
 
255
        return1(ecl_nth(n, x));\
256
256
}
257
257
cl_object @fifth        LENTH(4)
258
258
cl_object @sixth        LENTH(5)
305
305
}
306
306
 
307
307
bool
308
 
endp(cl_object x)
 
308
ecl_endp(cl_object x)
309
309
{
310
310
        if (CONSP(x))
311
311
                return(FALSE);
337
337
cl_object
338
338
cl_nth(cl_object n, cl_object x)
339
339
{
340
 
        @(return nth(fixint(n), x))
 
340
        @(return ecl_nth(fixint(n), x))
341
341
}
342
342
 
343
343
cl_object
344
 
nth(cl_fixnum n, cl_object x)
 
344
ecl_nth(cl_fixnum n, cl_object x)
345
345
{
346
346
        if (n < 0)
347
347
                FEtype_error_index(x, MAKE_FIXNUM(n));
359
359
cl_object
360
360
cl_nthcdr(cl_object n, cl_object x)
361
361
{
362
 
        @(return nthcdr(fixint(n), x))
 
362
        @(return ecl_nthcdr(fixint(n), x))
363
363
}
364
364
 
365
365
cl_object
366
 
nthcdr(cl_fixnum n, cl_object x)
 
366
ecl_nthcdr(cl_fixnum n, cl_object x)
367
367
{
368
368
        if (n < 0)
369
369
                FEtype_error_index(x, MAKE_FIXNUM(n));
370
 
        while (n-- > 0 && !endp(x))
 
370
        while (n-- > 0 && !ecl_endp(x))
371
371
                x = CDR(x);
372
372
        return(x);
373
373
}
464
464
@)
465
465
 
466
466
cl_object
467
 
nconc(cl_object l, cl_object y)
 
467
ecl_nconc(cl_object l, cl_object y)
468
468
{
469
469
        cl_object x = l, x1;
470
470
 
535
535
                if (delay) delay--; else r = CDR(r);
536
536
        } end_loop_for_on;
537
537
        if (delay > 0)
538
 
                /* nn > length(lis) */
 
538
                /* nn > ecl_length(lis) */
539
539
                lis = Cnil;
540
540
        else
541
541
                CDR(r) = Cnil;
548
548
        cl_object res = Cnil, *fill = &res;
549
549
 
550
550
        loop_for_on(x) {
551
 
                if (eql(x, y))
 
551
                if (ecl_eql(x, y))
552
552
                        @(return res)
553
553
                else
554
554
                        fill = &CDR(*fill = CONS(CAR(x), Cnil));
557
557
           in the list. When Y was not a member of the list, LDIFF must set
558
558
           this value in the output, because it produces an exact copy of the
559
559
           dotted list. */
560
 
        if (!eql(x, y))
 
560
        if (!ecl_eql(x, y))
561
561
                *fill = x;
562
562
        @(return res)
563
563
}
705
705
@)
706
706
 
707
707
bool
708
 
member_eq(cl_object x, cl_object l)
 
708
ecl_member_eq(cl_object x, cl_object l)
709
709
{
710
710
        loop_for_in(l) {
711
711
                if (x == CAR(l))
726
726
 
727
727
/* Added for use by the compiler, instead of open coding them. Beppe */
728
728
cl_object
729
 
memql(cl_object x, cl_object l)
 
729
ecl_memql(cl_object x, cl_object l)
730
730
{
731
731
        loop_for_in(l) {
732
 
                if (eql(x, CAR(l)))
 
732
                if (ecl_eql(x, CAR(l)))
733
733
                        return(l);
734
734
        } end_loop_for_in;
735
735
        return(Cnil);
736
736
}
737
737
 
738
738
cl_object
739
 
member(cl_object x, cl_object l)
 
739
ecl_member(cl_object x, cl_object l)
740
740
{
741
741
        loop_for_in(l) {
742
 
                if (equal(x, CAR(l)))
 
742
                if (ecl_equal(x, CAR(l)))
743
743
                        return(l);
744
744
        } end_loop_for_in;
745
745
        return(Cnil);
765
765
cl_tailp(cl_object y, cl_object x)
766
766
{
767
767
        loop_for_on(x) {
768
 
                if (eql(x, y))
 
768
                if (ecl_eql(x, y))
769
769
                        @(return Ct)
770
770
        } end_loop_for_on;
771
771
        return cl_eql(x, y);
802
802
        k = keys;
803
803
        d = data;
804
804
        loop_for_in(k) {
805
 
                if (endp(d))
 
805
                if (ecl_endp(d))
806
806
                        goto error;
807
807
                a_list = CONS(CONS(CAR(k), CAR(d)), a_list);
808
808
                d = CDR(d);
809
809
        } end_loop_for_in;
810
 
        if (!endp(d))
 
810
        if (!ecl_endp(d))
811
811
error:      FEerror("The keys ~S and the data ~S are not of the same length",
812
812
                    2, keys, data);
813
813
        @(return a_list)
870
870
 
871
871
/* Added for use by the compiler, instead of open coding them. Beppe */
872
872
cl_object
873
 
assq(cl_object x, cl_object l)
 
873
ecl_assq(cl_object x, cl_object l)
874
874
{
875
875
        loop_for_in(l) {
876
876
                if (x == CAAR(l))
880
880
}
881
881
 
882
882
cl_object
883
 
assql(cl_object x, cl_object l)
884
 
{
885
 
        loop_for_in(l) {
886
 
                if (eql(x, CAAR(l)))
887
 
                        return(CAR(l));
888
 
        } end_loop_for_in;
889
 
        return(Cnil);
890
 
}
891
 
 
892
 
cl_object
893
 
assoc(cl_object x, cl_object l)
894
 
{
895
 
        loop_for_in(l) {
896
 
                if (equal(x, CAAR(l)))
897
 
                        return(CAR(l));
898
 
        } end_loop_for_in;
899
 
        return(Cnil);
900
 
}
901
 
 
902
 
cl_object
903
 
assqlp(cl_object x, cl_object l)
904
 
{
905
 
        loop_for_in(l) {
906
 
                if (equalp(x, CAR(CAR(l))))
 
883
ecl_assql(cl_object x, cl_object l)
 
884
{
 
885
        loop_for_in(l) {
 
886
                if (ecl_eql(x, CAAR(l)))
 
887
                        return(CAR(l));
 
888
        } end_loop_for_in;
 
889
        return(Cnil);
 
890
}
 
891
 
 
892
cl_object
 
893
ecl_assoc(cl_object x, cl_object l)
 
894
{
 
895
        loop_for_in(l) {
 
896
                if (ecl_equal(x, CAAR(l)))
 
897
                        return(CAR(l));
 
898
        } end_loop_for_in;
 
899
        return(Cnil);
 
900
}
 
901
 
 
902
cl_object
 
903
ecl_assqlp(cl_object x, cl_object l)
 
904
{
 
905
        loop_for_in(l) {
 
906
                if (ecl_equalp(x, CAR(CAR(l))))
907
907
                        return(CAR(l));
908
908
        } end_loop_for_in;
909
909
        return(Cnil);