caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Why is (@) written in O'Caml?
@ 2002-12-05 20:47 Oleg
  2002-12-05 21:16 ` Pal-Kristian Engstad
  0 siblings, 1 reply; 6+ messages in thread
From: Oleg @ 2002-12-05 20:47 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-12-05 23:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-05 20:47 [Caml-list] Why is (@) written in O'Caml? Oleg
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

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).