caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nathan Mishra Linger" <nathan.mishralinger@gmail.com>
To: caml-list@inria.fr
Subject: surprised by string_of_bool
Date: Tue, 27 May 2008 16:10:31 -0700	[thread overview]
Message-ID: <ab0c618e0805271610sf3d1859w8fd51243b0aa598a@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

Consider the following transcript.

        Objective Caml version 3.10.0

# string_of_bool true == string_of_bool true;;
- : bool = true
# String.fill (string_of_bool true) 0 4 '@';;
- : unit = ()
# string_of_bool true;;
- : string = "@@@@"

Perhaps this has been discussed before, but I found this to be disturbing.
It seems easy enough to fix this problem, so that, for example, print_string
(string_of_bool true) always does the same thing.
The "correct" strategy seems to be used for string_of_float infinity:

# string_of_float infinity;;
- : string = "inf"
# string_of_float infinity == string_of_float infinity;;
- : bool = false

Nathan Mishra-Linger

[-- Attachment #2: Type: text/html, Size: 877 bytes --]

             reply	other threads:[~2008-05-27 23:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-27 23:10 Nathan Mishra Linger [this message]
2008-05-28  8:02 ` [Caml-list] " David Allsopp
2008-05-28  8:14   ` Jon Harrop

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=ab0c618e0805271610sf3d1859w8fd51243b0aa598a@mail.gmail.com \
    --to=nathan.mishralinger@gmail.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;
as well as URLs for NNTP newsgroup(s).