From: Ivan Gotovchits <ivg@ieee.org>
To: caml-list@inria.fr
Subject: [Caml-list] Removing repeating code
Date: Fri, 18 Jan 2013 08:57:58 +0400 [thread overview]
Message-ID: <871udjt7e1.fsf@golf.niidar.ru> (raw)
Hi!
It was difficult to find a proper phrase for a subject field, sorry. But
in ocaml it is really easier to formulate, so going right to the
question.
Are there any possibility to remove code dublicating in a following
function:
let f = let g = Array.length in function
| Strings a -> g a
| Floats a -> g a
which have a type
val f : value -> int
where value is
type value =
| Strings of string array
| Floats of float array
May be there is some trick?
Thanks in advance!
--
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
next reply other threads:[~2013-01-18 4:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 4:57 Ivan Gotovchits [this message]
2013-01-18 6:13 ` Erkki Seppala
2013-01-18 6:32 ` Ivan Gotovchits
2013-01-18 7:08 ` Erkki Seppala
2013-01-18 14:14 ` Gabriel Scherer
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=871udjt7e1.fsf@golf.niidar.ru \
--to=ivg@ieee.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