caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: cashin@cs.uga.edu
To: "Mattias Waldau" <mattias.waldau@abc.se>
Cc: "'Ocaml Mailing List'" <caml-list@inria.fr>
Subject: Re: [Caml-list] Efficiency of 'a list
Date: Sat, 03 May 2003 22:08:45 -0400	[thread overview]
Message-ID: <87r87fv4ya.fsf@cs.uga.edu> (raw)
In-Reply-To: <03ea01c311a3$ee573560$0200a8c0@gateway> ("Mattias Waldau"'s message of "Sat, 3 May 2003 20:43:41 +0200")

"Mattias Waldau" <mattias.waldau@abc.se> writes:

> *** Do not use lists, there is always a better datastructure *** 

That's kind of silly.  Sometimes lists are the natural datastructure
to use.  If you know what you're doing, use lists when appropriate!

I suppose the reason nobody else has responded to this
over-generalization is that it's really not specific to ocaml and so
of questionable relevance here.  However, I don't like thinking that
people who aren't yet comfortable with data structures may be reading
this suggestion and taking it literally.

Whenever you've got a situation where access is always via
straightforward iteration and modification is at the beginning or end
of a sequence, it doesn't make sense to use a hash table or even a
tree.  When you don't know the size ahead of time, it doesn't make
sense to use an array either.  A list is just the right thing in that
case.

Witness the linux kernel, which uses lists when lists are the most
natrural, efficient data structure for the task at hand.  

...
> The result of this is that you get all these questions in this forum
> complaining about performance. Most of the questions would never
> have been asked if the author would have used the correct
> datastructure, mostly Hash/Map or Set.

The solution is not to compound the confusion by saying, "don't use
lists".  It would be more helpful to point to resources that describe
what data structures to use under different circumstances.

-- 
--Ed L Cashin     PGP public key: http://noserose.net/e/pgp/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2003-05-04  2:08 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-02 19:27 Eray Ozkural
2003-05-03  5:43 ` Mattias Waldau
2003-05-03  8:16   ` Ville-Pertti Keinonen
2003-05-03 14:12   ` Vitaly Lugovsky
2003-05-03 18:43     ` Mattias Waldau
2003-05-03 20:01       ` Eray Ozkural
2003-05-03 23:17       ` Eray Ozkural
2003-05-04  2:08       ` cashin [this message]
2003-05-04  4:08         ` alc
2003-05-04  5:32           ` Ed L Cashin
2003-05-04  6:46           ` [Caml-list] Two types of efficiency (Was Efficiency of 'a list) Mattias Waldau
2003-05-04  7:35             ` John Max Skaller
2003-05-04 11:52               ` Olivier Andrieu
2003-05-05 11:04                 ` John Max Skaller
2003-05-04 16:48               ` brogoff
2003-05-04  7:43             ` Ville-Pertti Keinonen
2003-05-04 12:50               ` Eray Ozkural
2003-05-04 12:48             ` Eray Ozkural
2003-05-05  7:31             ` Diego Olivier Fernandez Pons
2003-05-05 11:11               ` Mattias Waldau
2003-05-05 13:17                 ` John Max Skaller
2003-05-05 11:49               ` Eray Ozkural
2003-05-05 11:57               ` Yaron M. Minsky
2003-05-05 13:32                 ` John Max Skaller
2003-05-06  2:49                   ` Nicolas Cannasse
2003-05-06 12:30                     ` Diego Olivier Fernandez Pons
2003-05-07  2:05                       ` Nicolas Cannasse
2003-05-05 16:38                 ` Diego Olivier Fernandez Pons
2003-05-05 18:05                   ` Eray Ozkural
2003-05-06 13:28                     ` Diego Olivier Fernandez Pons
2003-05-13 11:35                   ` [Caml-list] Data Structure Libraries (was: Two types of efficiency) Oleg Trott
2003-05-04  7:55           ` [Caml-list] Efficiency of 'a list Ville-Pertti Keinonen
2003-05-04 10:56             ` Neel Krishnaswami
2003-05-04 12:56               ` Eray Ozkural
2003-05-04 13:35                 ` Falk Hueffner
2003-05-04 12:38           ` Eray Ozkural
2003-05-04  8:07         ` Ville-Pertti Keinonen
2003-05-04 15:54           ` Ed L Cashin
2003-05-05 23:52           ` Garry Hodgson
2003-05-03 20:03   ` Eray Ozkural
2003-05-03 21:13 ` Lauri Alanko
2003-05-03 22:03   ` Eray Ozkural

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r87fv4ya.fsf@cs.uga.edu \
    --to=cashin@cs.uga.edu \
    --cc=caml-list@inria.fr \
    --cc=mattias.waldau@abc.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).