* explict vs inexplicit constant parameters
@ 2000-08-03 4:10 Julian Assange
2000-08-04 18:23 ` Alain Frisch
0 siblings, 1 reply; 2+ messages in thread
From: Julian Assange @ 2000-08-03 4:10 UTC (permalink / raw)
To: caml-list; +Cc: proff
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-08-05 18:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-03 4:10 explict vs inexplicit constant parameters Julian Assange
2000-08-04 18:23 ` Alain Frisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox