Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Julian Assange <proff@iq.org>
To: caml-list@inria.fr
Cc: proff@iq.org
Subject: explict vs inexplicit constant parameters
Date: 03 Aug 2000 14:10:54 +1000	[thread overview]
Message-ID: <wxn1ivrnld.fsf@foo.iq.org> (raw)


I often use the following:

let findpair e l =
  let rec find = function
    | [] -> None
    | (a,b)::tl -> if a = e then Some b else findpair tl 
  in
  find l

instead of:

let findpair e l =
  let rec find e = function
    | [] -> None
    | (a,b)::tl -> if a = e then Some b else findpair e tl 
  in
  find e l

Is ocaml able to generate faster code for the former?

Stylistically, I'm not sure whether these constructs are a good thing
or not. Symbolic brevity makes makes it easier to read for small
contexts.  On the other hand for larger contexts, the de-localisation
of variables makes the whole thing harder to follow and dangerous to
re-order.

Cheers,
Julian.



             reply	other threads:[~2000-08-04 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-03  4:10 Julian Assange [this message]
2000-08-04 18:23 ` Alain Frisch

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=wxn1ivrnld.fsf@foo.iq.org \
    --to=proff@iq.org \
    --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