9#include <metalang99/priv/bool.h>
10#include <metalang99/priv/util.h>
30#define ML99_cons(x, xs) ML99_call(ML99_cons, x, xs)
35#define ML99_nil(...) ML99_callUneval(ML99_nil, )
52#define ML99_isCons(list) ML99_call(ML99_isCons, list)
69#define ML99_isNil(list) ML99_call(ML99_isNil, list)
83#define ML99_listHead(list) ML99_call(ML99_listHead, list)
100#define ML99_listTail(list) ML99_call(ML99_listTail, list)
114#define ML99_listLast(list) ML99_call(ML99_listLast, list)
131#define ML99_listInit(list) ML99_call(ML99_listInit, list)
147#define ML99_list(...) ML99_call(ML99_list, __VA_ARGS__)
171#define ML99_listFromTuples(f, ...) ML99_call(ML99_listFromTuples, f, __VA_ARGS__)
188#define ML99_listFromSeq(seq) ML99_call(ML99_listFromSeq, seq)
205#define ML99_listLen(list) ML99_call(ML99_listLen, list)
224#define ML99_LIST_EVAL(...) ML99_EVAL(ML99_call(ML99_listUnwrap, __VA_ARGS__))
241#define ML99_LIST_EVAL_COMMA_SEP(...) ML99_EVAL(ML99_call(ML99_listUnwrapCommaSep, __VA_ARGS__))
255#define ML99_listAppend(list, other) ML99_call(ML99_listAppend, list, other)
269#define ML99_listAppendItem(item, list) ML99_call(ML99_listAppendItem, item, list)
287#define ML99_listUnwrap(list) ML99_call(ML99_listUnwrap, list)
305#define ML99_listUnwrapCommaSep(list) ML99_call(ML99_listUnwrapCommaSep, list)
319#define ML99_listReverse(list) ML99_call(ML99_listReverse, list)
333#define ML99_listGet(i, list) ML99_call(ML99_listGet, i, list)
352#define ML99_listFoldr(f, init, list) ML99_call(ML99_listFoldr, f, init, list)
371#define ML99_listFoldl(f, init, list) ML99_call(ML99_listFoldl, f, init, list)
387#define ML99_listFoldl1(f, list) ML99_call(ML99_listFoldl1, f, list)
401#define ML99_listIntersperse(item, list) ML99_call(ML99_listIntersperse, item, list)
415#define ML99_listPrependToAll(item, list) ML99_call(ML99_listPrependToAll, item, list)
430#define ML99_listMap(f, list) ML99_call(ML99_listMap, f, list)
447#define ML99_listMapI(f, list) ML99_call(ML99_listMapI, f, list)
454#define ML99_listMapInPlace(f, list) ML99_call(ML99_listMapInPlace, f, list)
461#define ML99_listMapInPlaceI(f, list) ML99_call(ML99_listMapInPlaceI, f, list)
476#define ML99_listFor(list, f) ML99_call(ML99_listFor, list, f)
490#define ML99_listMapInitLast(f_init, f_last, list) \
491 ML99_call(ML99_listMapInitLast, f_init, f_last, list)
504#define ML99_listForInitLast(list, f_init, f_last) \
505 ML99_call(ML99_listForInitLast, list, f_init, f_last)
520#define ML99_listFilter(f, list) ML99_call(ML99_listFilter, f, list)
540#define ML99_listFilterMap(f, list) ML99_call(ML99_listFilterMap, f, list)
558#define ML99_listEq(cmp, list, other) ML99_call(ML99_listEq, cmp, list, other)
576#define ML99_listContains(cmp, item, list) ML99_call(ML99_listContains, cmp, item, list)
591#define ML99_listTake(n, list) ML99_call(ML99_listTake, n, list)
606#define ML99_listTakeWhile(f, list) ML99_call(ML99_listTakeWhile, f, list)
621#define ML99_listDrop(n, list) ML99_call(ML99_listDrop, n, list)
636#define ML99_listDropWhile(f, list) ML99_call(ML99_listDropWhile, f, list)
650#define ML99_listZip(list, other) ML99_call(ML99_listZip, list, other)
666#define ML99_listUnzip(list) ML99_call(ML99_listUnzip, list)
683#define ML99_listReplicate(n, item) ML99_call(ML99_listReplicate, n, item)
699#define ML99_listPartition(f, list) ML99_call(ML99_listPartition, f, list)
722#define ML99_listAppl(f, list) ML99_call(ML99_listAppl, f, list)
724#define ML99_CONS(x, xs) ML99_CHOICE(cons, x, xs)
725#define ML99_NIL(...) ML99_CHOICE(nil, ~)
726#define ML99_IS_CONS(list) ML99_NOT(ML99_IS_NIL(list))
727#define ML99_IS_NIL(list) ML99_PRIV_IS_NIL(list)
729#ifndef DOXYGEN_IGNORE
731#define ML99_cons_IMPL(x, xs) v(ML99_CONS(x, xs))
732#define ML99_nil_IMPL(...) v(ML99_NIL())
734#define ML99_isCons_IMPL(list) v(ML99_IS_CONS(list))
735#define ML99_isNil_IMPL(list) v(ML99_IS_NIL(list))
737#define ML99_listHead_IMPL(list) ML99_match_IMPL(list, ML99_PRIV_listHead_)
738#define ML99_PRIV_listHead_nil_IMPL(_) ML99_PRIV_EMPTY_LIST_ERROR(listHead)
739#define ML99_PRIV_listHead_cons_IMPL(x, _xs) v(x)
741#define ML99_listTail_IMPL(list) ML99_match_IMPL(list, ML99_PRIV_listTail_)
742#define ML99_PRIV_listTail_nil_IMPL(_) ML99_PRIV_EMPTY_LIST_ERROR(listTail)
743#define ML99_PRIV_listTail_cons_IMPL(_x, xs) v(xs)
745#define ML99_listLast_IMPL(list) ML99_match_IMPL(list, ML99_PRIV_listLast_)
746#define ML99_PRIV_listLast_nil_IMPL(_) ML99_PRIV_EMPTY_LIST_ERROR(listLast)
747#define ML99_PRIV_listLast_cons_IMPL(x, xs) \
748 ML99_PRIV_IF(ML99_IS_NIL(xs), v(x), ML99_listLast_IMPL(xs))
750#define ML99_listInit_IMPL(list) ML99_match_IMPL(list, ML99_PRIV_listInit_)
751#define ML99_PRIV_listInit_nil_IMPL(_) ML99_PRIV_EMPTY_LIST_ERROR(listInit)
752#define ML99_PRIV_listInit_cons_IMPL(x, xs) \
753 ML99_PRIV_IF(ML99_IS_NIL(xs), v(ML99_NIL()), ML99_cons(v(x), ML99_listInit_IMPL(xs)))
757#define ML99_list_IMPL(...) \
758 ML99_PRIV_listProgress_IMPL(ML99_VARIADICS_COUNT(__VA_ARGS__), __VA_ARGS__, ~)
761#define ML99_PRIV_listProgress_IMPL(count, ...) \
763 ML99_NAT_EQ(count, 4), \
764 ML99_PRIV_listDone_4, \
766 ML99_NAT_EQ(count, 3), \
767 ML99_PRIV_listDone_3, \
769 ML99_NAT_EQ(count, 2), \
770 ML99_PRIV_listDone_2, \
772 ML99_NAT_EQ(count, 1), \
773 ML99_PRIV_listDone_1, \
775 ML99_NAT_EQ(count, 0), \
776 ML99_PRIV_listDone_0, \
777 ML99_PRIV_listProgressAux))))) \
780#define ML99_PRIV_listProgressAux(count, x, ...) \
781 ML99_cons(v(x), ML99_callUneval(ML99_PRIV_listProgress, ML99_DEC(count), __VA_ARGS__))
783#define ML99_PRIV_listDone_0(_count, _) v(ML99_NIL())
784#define ML99_PRIV_listDone_1(_count, a, _) v(ML99_CONS(a, ML99_NIL()))
785#define ML99_PRIV_listDone_2(_count, a, b, _) v(ML99_CONS(a, ML99_CONS(b, ML99_NIL())))
786#define ML99_PRIV_listDone_3(_count, a, b, c, _) \
787 v(ML99_CONS(a, ML99_CONS(b, ML99_CONS(c, ML99_NIL()))))
788#define ML99_PRIV_listDone_4(_count, a, b, c, d, _) \
789 v(ML99_CONS(a, ML99_CONS(b, ML99_CONS(c, ML99_CONS(d, ML99_NIL())))))
794#define ML99_listFromTuples_IMPL(f, ...) ML99_PRIV_listFromTuplesAux_IMPL(f, __VA_ARGS__, ~)
796#define ML99_PRIV_listFromTuplesAux_IMPL(f, x, ...) \
797 ML99_PRIV_CAT(ML99_PRIV_listFromTuples_, ML99_IS_UNTUPLE(x))(f, x, __VA_ARGS__)
799#define ML99_PRIV_listFromTuples_1(_f, x, ...) ML99_PRIV_NOT_TUPLE_ERROR(x)
800#define ML99_PRIV_listFromTuples_0(f, x, ...) \
802 ML99_appl_IMPL(f, ML99_UNTUPLE(x)), \
804 ML99_VARIADICS_IS_SINGLE(__VA_ARGS__), \
806 ML99_callUneval(ML99_PRIV_listFromTuplesAux, f, __VA_ARGS__)))
809#define ML99_listFromSeq_IMPL(seq) \
810 ML99_PRIV_CAT(ML99_PRIV_listFromSeq_, ML99_SEQ_IS_EMPTY(seq))(seq)
811#define ML99_PRIV_listFromSeq_1 ML99_nil_IMPL
812#define ML99_PRIV_listFromSeq_0(seq) \
813 ML99_cons(v(ML99_SEQ_GET(0)(seq)), ML99_callUneval(ML99_listFromSeq, ML99_SEQ_TAIL(seq)))
815#define ML99_listLen_IMPL(list) ML99_match_IMPL(list, ML99_PRIV_listLen_)
816#define ML99_PRIV_listLen_nil_IMPL(_) v(0)
817#define ML99_PRIV_listLen_cons_IMPL(_x, xs) ML99_inc(ML99_listLen_IMPL(xs))
819#define ML99_listAppend_IMPL(list, other) \
820 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listAppend_, other)
821#define ML99_PRIV_listAppend_nil_IMPL(_, other) v(other)
822#define ML99_PRIV_listAppend_cons_IMPL(x, xs, other) \
823 ML99_cons(v(x), ML99_listAppend_IMPL(xs, other))
825#define ML99_listAppendItem_IMPL(item, list) ML99_listAppend_IMPL(list, ML99_CONS(item, ML99_NIL()))
827#define ML99_listUnwrap_IMPL(list) ML99_match_IMPL(list, ML99_PRIV_listUnwrap_)
828#define ML99_PRIV_listUnwrap_nil_IMPL ML99_empty_IMPL
829#define ML99_PRIV_listUnwrap_cons_IMPL(x, xs) ML99_TERMS(v(x), ML99_listUnwrap_IMPL(xs))
831#define ML99_listReverse_IMPL(list) ML99_match_IMPL(list, ML99_PRIV_listReverse_)
832#define ML99_PRIV_listReverse_nil_IMPL ML99_nil_IMPL
833#define ML99_PRIV_listReverse_cons_IMPL(x, xs) ML99_listAppendItem(v(x), ML99_listReverse_IMPL(xs))
835#define ML99_listGet_IMPL(i, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listGet_, i)
836#define ML99_PRIV_listGet_nil_IMPL(_, i) ML99_PRIV_EMPTY_LIST_ERROR(ML99_listGet)
837#define ML99_PRIV_listGet_cons_IMPL(x, xs, i) \
838 ML99_PRIV_IF(ML99_NAT_EQ(i, 0), v(x), ML99_listGet_IMPL(ML99_DEC(i), xs))
840#define ML99_listFoldr_IMPL(f, init, list) \
841 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listFoldr_, f, init)
842#define ML99_PRIV_listFoldr_nil_IMPL(_, _f, acc) v(acc)
843#define ML99_PRIV_listFoldr_cons_IMPL(x, xs, f, acc) \
844 ML99_call(ML99_appl2, v(f, x), ML99_listFoldr_IMPL(f, acc, xs))
846#define ML99_listFoldl_IMPL(f, init, list) \
847 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listFoldl_, f, init)
848#define ML99_PRIV_listFoldl_nil_IMPL(_, _f, acc) v(acc)
849#define ML99_PRIV_listFoldl_cons_IMPL(x, xs, f, acc) \
850 ML99_listFoldl(v(f), ML99_appl2_IMPL(f, acc, x), v(xs))
852#define ML99_listFoldl1_IMPL(f, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listFoldl1_, f)
853#define ML99_PRIV_listFoldl1_nil_IMPL(_, _f) ML99_PRIV_EMPTY_LIST_ERROR(ML99_listFoldl1)
854#define ML99_PRIV_listFoldl1_cons_IMPL(x, xs, f) ML99_listFoldl_IMPL(f, x, xs)
856#define ML99_listIntersperse_IMPL(item, list) \
857 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listIntersperse_, item)
858#define ML99_PRIV_listIntersperse_nil_IMPL ML99_nil_IMPL
859#define ML99_PRIV_listIntersperse_cons_IMPL(x, xs, item) \
860 ML99_cons(v(x), ML99_listPrependToAll_IMPL(item, xs))
862#define ML99_listPrependToAll_IMPL(item, list) \
863 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listPrependToAll_, item)
864#define ML99_PRIV_listPrependToAll_nil_IMPL ML99_nil_IMPL
865#define ML99_PRIV_listPrependToAll_cons_IMPL(x, xs, item) \
866 ML99_cons(v(item), ML99_cons(v(x), ML99_listPrependToAll_IMPL(item, xs)))
868#define ML99_listMap_IMPL(f, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listMap_, f)
869#define ML99_PRIV_listMap_nil_IMPL ML99_nil_IMPL
870#define ML99_PRIV_listMap_cons_IMPL(x, xs, f) \
871 ML99_cons(ML99_appl_IMPL(f, x), ML99_listMap_IMPL(f, xs))
873#define ML99_listMapI_IMPL(f, list) ML99_PRIV_listMapIAux_IMPL(f, list, 0)
874#define ML99_PRIV_listMapIAux_IMPL(f, list, i) \
875 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listMapI_, f, i)
876#define ML99_PRIV_listMapI_nil_IMPL ML99_nil_IMPL
877#define ML99_PRIV_listMapI_cons_IMPL(x, xs, f, i) \
878 ML99_cons(ML99_appl2_IMPL(f, x, i), ML99_PRIV_listMapIAux_IMPL(f, xs, ML99_INC(i)))
880#define ML99_listMapInPlace_IMPL(f, list) \
881 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listMapInPlace_, f)
882#define ML99_PRIV_listMapInPlace_nil_IMPL ML99_empty_IMPL
883#define ML99_PRIV_listMapInPlace_cons_IMPL(x, xs, f) \
884 ML99_TERMS(ML99_appl_IMPL(f, x), ML99_listMapInPlace_IMPL(f, xs))
886#define ML99_listMapInPlaceI_IMPL(f, list) ML99_PRIV_listMapInPlaceIAux_IMPL(f, list, 0)
887#define ML99_PRIV_listMapInPlaceIAux_IMPL(f, list, i) \
888 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listMapInPlaceI_, f, i)
889#define ML99_PRIV_listMapInPlaceI_nil_IMPL ML99_empty_IMPL
890#define ML99_PRIV_listMapInPlaceI_cons_IMPL(x, xs, f, i) \
891 ML99_TERMS(ML99_appl2_IMPL(f, x, i), ML99_PRIV_listMapInPlaceIAux_IMPL(f, xs, ML99_INC(i)))
893#define ML99_listFor_IMPL(list, f) ML99_listMap_IMPL(f, list)
895#define ML99_listMapInitLast_IMPL(f_init, f_last, list) \
896 ML99_listAppendItem( \
897 ML99_appl(v(f_last), ML99_listLast_IMPL(list)), \
898 ML99_listMap(v(f_init), ML99_listInit_IMPL(list)))
900#define ML99_listForInitLast_IMPL(list, f_init, f_last) \
901 ML99_listMapInitLast_IMPL(f_init, f_last, list)
905#define ML99_listFilter_IMPL(f, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listFilter_, f)
907#define ML99_PRIV_listFilter_nil_IMPL ML99_nil_IMPL
908#define ML99_PRIV_listFilter_cons_IMPL(x, xs, f) \
910 ML99_boolMatchWithArgs, \
911 ML99_appl_IMPL(f, x), \
912 v(ML99_PRIV_listFilter_cons_, x), \
913 ML99_listFilter_IMPL(f, xs))
915#define ML99_PRIV_listFilter_cons_1_IMPL(x, rest) v(ML99_CONS(x, rest))
916#define ML99_PRIV_listFilter_cons_0_IMPL(_x, rest) v(rest)
921#define ML99_listFilterMap_IMPL(f, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listFilterMap_, f)
923#define ML99_PRIV_listFilterMap_nil_IMPL ML99_nil_IMPL
924#define ML99_PRIV_listFilterMap_cons_IMPL(x, xs, f) \
925 ML99_call(ML99_matchWithArgs, ML99_appl_IMPL(f, x), v(ML99_PRIV_listFilterMap_cons_, f, xs))
927#define ML99_PRIV_listFilterMap_cons_just_IMPL(y, f, xs) \
928 ML99_cons(v(y), ML99_listFilterMap_IMPL(f, xs))
929#define ML99_PRIV_listFilterMap_cons_nothing_IMPL(_, f, xs) ML99_listFilterMap_IMPL(f, xs)
934#define ML99_listEq_IMPL(cmp, list, other) \
935 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listEq_, other, cmp)
937#define ML99_PRIV_listEq_nil_IMPL(_, other, _cmp) v(ML99_IS_NIL(other))
938#define ML99_PRIV_listEq_cons_IMPL(x, xs, other, cmp) \
939 ML99_matchWithArgs_IMPL(other, ML99_PRIV_listEq_cons_, x, xs, cmp)
941#define ML99_PRIV_listEq_cons_nil_IMPL ML99_false_IMPL
942#define ML99_PRIV_listEq_cons_cons_IMPL(other_x, other_xs, x, xs, cmp) \
944 ML99_call(ML99_if, ML99_appl2_IMPL(cmp, x, other_x), v(ML99_listEq, ML99_false)), \
945 v(cmp, xs, other_xs))
948#define ML99_listContains_IMPL(cmp, item, list) \
949 ML99_matchWithArgs_IMPL(list, ML99_PRIV_listContains_, item, cmp)
950#define ML99_PRIV_listContains_nil_IMPL ML99_false_IMPL
951#define ML99_PRIV_listContains_cons_IMPL(x, xs, item, cmp) \
953 ML99_call(ML99_if, ML99_appl2_IMPL(cmp, x, item), v(ML99_true, ML99_listContains)), \
956#define ML99_listTake_IMPL(n, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listTake_, n)
957#define ML99_PRIV_listTake_nil_IMPL ML99_nil_IMPL
958#define ML99_PRIV_listTake_cons_IMPL(x, xs, i) \
962 ML99_cons(v(x), ML99_listTake_IMPL(ML99_DEC(i), xs)))
966#define ML99_listTakeWhile_IMPL(f, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listTakeWhile_, f)
968#define ML99_PRIV_listTakeWhile_nil_IMPL ML99_nil_IMPL
969#define ML99_PRIV_listTakeWhile_cons_IMPL(x, xs, f) \
971 ML99_boolMatchWithArgs, \
972 ML99_appl_IMPL(f, x), \
973 v(ML99_PRIV_listTakeWhile_cons_, x, xs, f))
975#define ML99_PRIV_listTakeWhile_cons_1_IMPL(x, xs, f) \
976 ML99_cons(v(x), ML99_listTakeWhile_IMPL(f, xs))
977#define ML99_PRIV_listTakeWhile_cons_0_IMPL ML99_nil_IMPL
980#define ML99_listDrop_IMPL(n, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listDrop_, n)
981#define ML99_PRIV_listDrop_nil_IMPL ML99_nil_IMPL
982#define ML99_PRIV_listDrop_cons_IMPL(x, xs, i) \
983 ML99_PRIV_IF(ML99_NAT_EQ(i, 0), v(ML99_CONS(x, xs)), ML99_listDrop_IMPL(ML99_DEC(i), xs))
987#define ML99_listDropWhile_IMPL(f, list) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listDropWhile_, f)
989#define ML99_PRIV_listDropWhile_nil_IMPL ML99_nil_IMPL
990#define ML99_PRIV_listDropWhile_cons_IMPL(x, xs, f) \
992 ML99_boolMatchWithArgs, \
993 ML99_appl_IMPL(f, x), \
994 v(ML99_PRIV_listDropWhile_cons_, x, xs, f))
996#define ML99_PRIV_listDropWhile_cons_0_IMPL(x, xs, _f) v(ML99_CONS(x, xs))
997#define ML99_PRIV_listDropWhile_cons_1_IMPL(_x, xs, f) ML99_listDropWhile_IMPL(f, xs)
1002#define ML99_listZip_IMPL(list, other) ML99_matchWithArgs_IMPL(list, ML99_PRIV_listZip_, other)
1004#define ML99_PRIV_listZip_nil_IMPL ML99_nil_IMPL
1005#define ML99_PRIV_listZip_cons_IMPL(x, xs, other) \
1006 ML99_matchWithArgs_IMPL(other, ML99_PRIV_listZip_cons_, x, xs)
1008#define ML99_PRIV_listZip_cons_nil_IMPL ML99_nil_IMPL
1009#define ML99_PRIV_listZip_cons_cons_IMPL(other_x, other_xs, x, xs) \
1010 ML99_cons(v(ML99_TUPLE(x, other_x)), ML99_listZip_IMPL(xs, other_xs))
1015#define ML99_listUnzip_IMPL(list) ML99_match_IMPL(list, ML99_PRIV_listUnzip_)
1017#define ML99_PRIV_listUnzip_nil_IMPL(_) v(ML99_TUPLE(ML99_NIL(), ML99_NIL()))
1018#define ML99_PRIV_listUnzip_cons_IMPL(x, xs) \
1019 ML99_call(ML99_PRIV_listUnzipProgress, v(x), ML99_listUnzip_IMPL(xs))
1021#define ML99_PRIV_listUnzipProgress_IMPL(x, rest) \
1022 v(ML99_TUPLE(ML99_PRIV_LIST_UNZIP_EXTEND(x, rest, 0), ML99_PRIV_LIST_UNZIP_EXTEND(x, rest, 1)))
1024#define ML99_PRIV_LIST_UNZIP_EXTEND(x, rest, i) \
1025 ML99_CONS(ML99_TUPLE_GET(i)(x), ML99_TUPLE_GET(i)(rest))
1028#define ML99_listReplicate_IMPL(n, item) \
1029 ML99_natMatchWithArgs_IMPL(n, ML99_PRIV_listReplicate_, item)
1030#define ML99_PRIV_listReplicate_Z_IMPL ML99_nil_IMPL
1031#define ML99_PRIV_listReplicate_S_IMPL(n, item) ML99_cons(v(item), ML99_listReplicate_IMPL(n, item))
1035#define ML99_listPartition_IMPL(f, list) \
1037 ML99_appl_IMPL(ML99_PRIV_listPartitionAux, f), \
1038 v(ML99_TUPLE(ML99_NIL(), ML99_NIL())), \
1041#define ML99_PRIV_listPartitionAux_IMPL(f, x, acc) \
1043 ML99_boolMatchWithArgs, \
1044 ML99_appl_IMPL(f, x), \
1045 v(ML99_PRIV_listPartition_, x, ML99_UNTUPLE(acc)))
1047#define ML99_PRIV_listPartition_1_IMPL(x, fst, snd) v(ML99_TUPLE(ML99_CONS(x, fst), snd))
1048#define ML99_PRIV_listPartition_0_IMPL(x, fst, snd) v(ML99_TUPLE(fst, ML99_CONS(x, snd)))
1051#define ML99_listAppl_IMPL(f, list) ML99_listFoldl_IMPL(ML99_appl, f, list)
1055#define ML99_listUnwrapCommaSep_IMPL(list) \
1057 ML99_IS_NIL(list), \
1059 ML99_variadicsTail(ML99_PRIV_listUnwrapCommaSepAux_IMPL(list)))
1061#define ML99_PRIV_listUnwrapCommaSepAux_IMPL(xs) ML99_match_IMPL(xs, ML99_PRIV_listUnwrapCommaSep_)
1063#define ML99_PRIV_listUnwrapCommaSep_nil_IMPL ML99_empty_IMPL
1064#define ML99_PRIV_listUnwrapCommaSep_cons_IMPL(x, xs) \
1065 ML99_TERMS(v(, x), ML99_PRIV_listUnwrapCommaSepAux_IMPL(xs))
1069#define ML99_PRIV_EMPTY_LIST_ERROR(f) ML99_fatal(ML99_##f, expected a non-empty list)
1072#define ML99_PRIV_IS_NIL(list) ML99_DETECT_IDENT(ML99_PRIV_IS_NIL_, ML99_CHOICE_TAG(list))
1073#define ML99_PRIV_IS_NIL_nil ()
1077#define ML99_cons_ARITY 2
1078#define ML99_nil_ARITY 1
1079#define ML99_isCons_ARITY 1
1080#define ML99_isNil_ARITY 1
1081#define ML99_listHead_ARITY 1
1082#define ML99_listTail_ARITY 1
1083#define ML99_listLast_ARITY 1
1084#define ML99_listInit_ARITY 1
1085#define ML99_list_ARITY 1
1086#define ML99_listFromTuples_ARITY 2
1087#define ML99_listFromSeq_ARITY 1
1088#define ML99_listLen_ARITY 1
1089#define ML99_listAppend_ARITY 2
1090#define ML99_listAppendItem_ARITY 2
1091#define ML99_listUnwrap_ARITY 1
1092#define ML99_listUnwrapCommaSep_ARITY 1
1093#define ML99_listReverse_ARITY 1
1094#define ML99_listGet_ARITY 2
1095#define ML99_listFoldr_ARITY 3
1096#define ML99_listFoldl_ARITY 3
1097#define ML99_listFoldl1_ARITY 2
1098#define ML99_listIntersperse_ARITY 2
1099#define ML99_listPrependToAll_ARITY 2
1100#define ML99_listMap_ARITY 2
1101#define ML99_listMapI_ARITY 2
1102#define ML99_listMapInPlace_ARITY 2
1103#define ML99_listMapInPlaceI_ARITY 2
1104#define ML99_listFor_ARITY 2
1105#define ML99_listMapInitLast_ARITY 3
1106#define ML99_listForInitLast_ARITY 3
1107#define ML99_listFilter_ARITY 2
1108#define ML99_listFilterMap_ARITY 2
1109#define ML99_listEq_ARITY 3
1110#define ML99_listContains_ARITY 3
1111#define ML99_listTake_ARITY 2
1112#define ML99_listTakeWhile_ARITY 2
1113#define ML99_listDrop_ARITY 2
1114#define ML99_listDropWhile_ARITY 2
1115#define ML99_listZip_ARITY 2
1116#define ML99_listUnzip_ARITY 1
1117#define ML99_listReplicate_ARITY 2
1118#define ML99_listPartition_ARITY 2
1119#define ML99_listAppl_ARITY 2
1121#define ML99_PRIV_listPartitionAux_ARITY 3
Choice types: (tag, ...).
Natural numbers: [0; 255].
Variadic arguments: x, y, z.