let lists_unordered_equal (_equal: '-> '-> bool) (_list1: 'a list) (_list2: 'b list) : bool =

  let rec do_lists_unordered_equal (list1: 'a list) (list2: 'b list) : bool =
    match list1 with
      | [] ->
          true

      | head :: tail ->
          let list2_remainder =
            list_remove_first (_equal head) list2
          in
            if list2 == list2_remainder then
              false
            else
              do_lists_unordered_equal tail list2_remainder
  in

    if List.length _list1 <> List.length _list2 then begin
      false
    end
    else begin
      do_lists_unordered_equal _list1 _list2
    end