caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Oleg <oleg_inconnu@myrealbox.com>
To: caml-list@inria.fr
Subject: [Caml-list] Why is (@) written in O'Caml?
Date: Thu, 5 Dec 2002 15:47:09 -0500	[thread overview]
Message-ID: <200212051547.09337.oleg_inconnu@myrealbox.com> (raw)

let rec (@) l1 l2 =
  match l1 with
    [] -> l2
  | hd :: tl -> hd :: (tl @ l2)

The O'Caml implementation of (@) is recursive and not tail-recursive. All one 
really has to do during "append" is copy l1 and set the last element's CDR to 
l2. I can see why this can not be done in O'Caml itself, but since (@) is 
such a common operation, I'm wondering why it was decided to implement it 
inefficently in O'Caml itself?

Cheers,
Oleg
-------------------
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


             reply	other threads:[~2002-12-05 20:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-05 20:47 Oleg [this message]
2002-12-05 21:16 ` Pal-Kristian Engstad
2002-12-05 21:24   ` Oleg
2002-12-05 21:55     ` Pal-Kristian Engstad
2002-12-05 23:27       ` Oleg
2002-12-05 23:53         ` Pal-Kristian Engstad

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=200212051547.09337.oleg_inconnu@myrealbox.com \
    --to=oleg_inconnu@myrealbox.com \
    --cc=caml-list@inria.fr \
    /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).