[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Buglet in ocaml-ldconf



On Mon, May 13, 2002 at 01:39:31AM +0200, Denis Barbier wrote:
> let sup_list src remove =
>   let rec f collected = function
>     | [] -> collected
>     | head::tail -> if List.exists (eq_line head) remove then f collected tail else f (collected@[head]) tail in
>   f [] src

better:

   let sup_list src remove =
     let rec f collected = function
       | [] -> collected
       | head::tail ->
         if List.exists (eq_line head) remove then
            f collected tail
         else
            f head::collected tail
      in
      List.rev (f [] src)

Cheers.

P.S. this is a probably a useless change while managing list short sized
like ones we are using, anyway ...

-- 
Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy
zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro
"I know you believe you understood what you think I said, but I am not
sure you realize that what you heard is not what I meant!" -- G.Romney

Attachment: pgpLyV2HmbWnZ.pgp
Description: PGP signature


Reply to: