Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: lloydmoore <lloyd@encantado.net>
To: caml-list@yquem.inria.fr
Subject: The Map and Fold
Date: Sat, 23 Dec 2006 15:48:21 +0000	[thread overview]
Message-ID: <1166888901.18736.9.camel@localhost.localdomain> (raw)

In reply to the relationship between map and fold, The fold difference
is that only a single entity is returned (the accumulator) as opposed
to, if you like, a place for each original array/list/vector member.
Fold is indeed an extended specialized version of map because it has to
perform both functions... iterate over the elements and use them as
function arguments but it then goes one step further and accumulates the
results as it iterates.

Using STL, this would be the difference between mapping a X.t into b X.t
and stopping there, or going the extra step and summising your new set
of results 'on the fly' as it were.

Hope this makes sense :D
http://www.encantado.net





                 reply	other threads:[~2006-12-23 14:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1166888901.18736.9.camel@localhost.localdomain \
    --to=lloyd@encantado.net \
    --cc=caml-list@yquem.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