From: Dwight VandenBerghe <dwight@pentasoft.com>
To: caml-list@inria.fr
Subject: how to coerce expression type?
Date: Mon, 21 Dec 1998 09:17:06 -0800 [thread overview]
Message-ID: <3.0.32.19981221091704.00bcd310@seanet.com> (raw)
I am converting older ocaml code to version 2.01, and
find that many expressions that passed through the previous
compilers fine now exhibit warning errors due to not being
of unit type. This happens when I evaluate an expression
for its side effects (the horror, the horror). Here's an
example:
let is_in_table table key =
try
Hashtbl.find table key;
true
with Not_found -> false;;
I don't want the result back from the lookup, I just want
to know if the key was present. So how do I "cast" the
find operation to unit, to quiet the warnings? I've tried
everything I can think of, things like
(Hashtbl.find table key) : ()
but have not yet hit upon the magic incantation.
Thank you.
Dwight
next reply other threads:[~1998-12-23 15:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-12-21 17:17 Dwight VandenBerghe [this message]
1998-12-23 15:01 ` Pierre Weis
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=3.0.32.19981221091704.00bcd310@seanet.com \
--to=dwight@pentasoft.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