caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Eric Merritt <cyberlync@yahoo.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Simple question
Date: Mon, 15 Apr 2002 13:08:54 -0700 (PDT)	[thread overview]
Message-ID: <20020415200854.17570.qmail@web13005.mail.yahoo.com> (raw)
In-Reply-To: <86it6wlmi8.fsf@laurelin.dementia.org>


> Actually, it's O(n) because it's straightforward and
> doesn't cause
> side-effects.  The O(n^2) is when it is used n
> times.  Here's an
> implementation that works similarly:
> 
> let rec append a b = match (a,b) with
>   | [], _ -> b
>   | h::t, _ -> h :: append t b
> 
> If you keep appending one element onto the end of a
> list, you can see
> that append has to run down the entire first list
> each time to build a
> new list with your new value at the end.  If you
> append one item at
> the beginning each time, it behaves substatntially
> like :: does.
> 
> So (@) is O(n) with n being the size of the first
> argument.

This actually makes allot of sense. I am very new to
the functional world (basically Ocaml and Erlang are
my current learning projects) so many of things that
might be obvious to a more experienced functional
programmer I do not see. This is slowly changing as I
write more code, of course ;). 

In allot of ways this strugle reminds me of my initial
attempts to learn the Object Oriented Paradigm, only
this is a little more foriegn. In any case, I thank
you all for your help and I hope to be joining your
ranks as a decent functional programmer one day.


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
-------------------
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-04-15 20:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-12 15:51 [Caml-list] Applications written in O'Caml Vincent Foley
2002-04-12 16:15 ` Benjamin C. Pierce
2002-04-12 16:44   ` [Caml-list] Simple question Eric Merritt
2002-04-12 16:59     ` Remi VANICAT
2002-04-12 17:04     ` Maxence Guesdon
2002-04-12 17:57       ` Remi VANICAT
2002-04-12 19:15         ` Eric Merritt
2002-04-12 19:55           ` John Prevost
2002-04-15 20:08             ` Eric Merritt [this message]
2002-04-12 20:20           ` james woodyatt
2002-04-13 11:10           ` Remi VANICAT
2002-04-13 12:45   ` [Caml-list] Applications written in O'Caml Oliver Bandel
2002-04-13 19:07     ` Benjamin C. Pierce
2002-04-12 16:40 ` Maxence Guesdon
2002-04-12 17:04 ` Warp
2002-04-13  2:27 ` eijiro_sumii
2002-04-13  3:28   ` Michael Vanier
2002-04-15  8:16 ` Nicolas barnier
2002-04-16 10:12 ` Jacek Chrzaszcz

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=20020415200854.17570.qmail@web13005.mail.yahoo.com \
    --to=cyberlync@yahoo.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).