Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: large hash tables
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christopher L Conway <cconway@c...>
Subject: Re: [Caml-list] Re: large hash tables
On Thu, Feb 21, 2008 at 8:54 AM, Damien Doligez <damien.doligez@inria.fr> wrote:
>
>  On 2008-02-20, at 17:02, Christopher L Conway wrote:
>
>  >>                let newList = List.rev_append [newElement] oldList in
>  >
>  > This is what is known as a "functional anti-pattern" [1].
>
>  Not really.  This is just a rather long-winded way to write
>
>                 let newList = newElement :: oldList in
>
>  but it doesn't take much more time or memory to execute.

That was silly of me. A point (not my original point) still stands:
the code is non-idiomatic.

List.rev_append [newElement] oldList
  = List.append [newElement] oldList
  = newElement :: oldList

Regards,
Chris