- [List.hd alist]
- @
- List.map
- (List.tl)
- (Sort.list
- (fun a b ->
- match order with
- MQAsc -> (List.hd a) < (List.hd b)
- | MQDesc -> (List.hd a) > (List.hd b)
- )
- (List.map
- (fun l -> [apply_func afunc (List.hd l)] @ l)
- (List.tl alist)
- )
- )
+ let before = Sys.time () in
+ let res =
+ let module S = Mathql_semantics in
+ (Sort.list
+ (fun {S.extra = e1} {S.extra = e2} ->
+ match order with
+ MQAsc -> e1 < e2
+ | MQDesc -> e1 > e2
+ )
+ (List.map
+ (fun {S.uri = u ; S.attributes = attr} -> {S.uri = u ; S.attributes = attr ; S.extra = (apply_func afunc u)})
+ alist
+ )
+ )
+ in
+ let after = Sys.time ()
+ and ll1 = string_of_int (List.length alist) in
+ let diff = string_of_float (after -. before) in
+ print_endline
+ ("SORTEDBY(" ^ ll1 ^ ") = " ^ string_of_int (List.length res) ^
+ ": " ^ diff ^ "s") ;
+ flush stdout ;
+ res