logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Misc.Stdlib.List - Extensions to the List module

Documentation

       Module List
        : sigendExtensionstotheListmoduletype'at = 'alistvalcompare : ('a->'a->int)->'at->'at->int

       The  lexicographic order supported by the provided order.  There is no constraint on the relative lengths
       of the lists.

       valequal : ('a->'a->bool)->'at->'at->bool

       Returns true if and only if the given lists have the same length and content with respect  to  the  given
       equality function.

       valsome_if_all_elements_are_some : 'aoptiont->'atoption

       If  all  elements of the given list are Some_ then Somexs is returned with the xs being the contents of
       those Some s, with order preserved.  Otherwise return None .

       valmap2_prefix : ('a->'b->'c)->'at->'bt->'ct*'btletr1,r2=map2_prefixfl1l2 If l1 is of length n and l2=h2@t2  with  h2  of  length  n,  r1  is
       List.map2fl1h1 and r2 is t2.

       valiteri2 : (int->'a->'b->unit)->'alist->'blist->unit

       Same  as List.iter2 , but the function is applied to the index of the element as first argument (counting
       from 0)

       valsplit_at : int->'at->'at*'atsplit_atnl returns the pair before,after where before is the n first  elements  of  l  and  after  the
       remaining ones.  If l has less than n elements, raises Invalid_argument.

       valchunks_of : int->'at->'attchunks_ofnt returns a list of nonempty lists whose concatenation is equal to the original list. Every
       list has n elements, except for possibly the last list, which may have fewer.  chunks_of raises if n<=0
       .

       valis_prefix : equal:('a->'a->bool)->'alist->of_:'alist->bool

       Returns true if and only if the given list, with respect to the given equality function on list  members,
       is a prefix of the list of_ .

       type'alongest_common_prefix_result = private {
        longest_common_prefix : 'alist ;
        first_without_longest_common_prefix : 'alist ;
        second_without_longest_common_prefix : 'alist ;
        }

       valfind_and_chop_longest_common_prefix : equal:('a->'a->bool)->first:'alist->second:'alist->'alongest_common_prefix_result

       Returns the longest list that, with respect to the provided equality function, is a prefix of both of the
       given lists.  The input lists, each with such longest common prefix removed, are also returned.

OCamldoc                                           2025-06-12                               Misc.Stdlib.List(3o)

Module

       Module   Misc.Stdlib.List

Name

       Misc.Stdlib.List -  Extensions to the List module

See Also