Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jean-Marc Alliot <jean-marc.alliot@irit.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Error: Unbound value abs_num
Date: Sun, 21 Jul 2013 13:33:54 +0200	[thread overview]
Message-ID: <51EBC722.90609@irit.fr> (raw)
In-Reply-To: <sympa.1374403490.23701.296@inria.fr>

Basic mistake :-)

Loading is not the same as opening.

You can either do (after #load):
# open Num;;
# abs_num;;
- : Num.num -> Num.num = <fun>

Or qualify the function with th module name:
# Num.abs_num;;
- : Num.num -> Num.num = <fun>

And then don't forget abs_num needs a Num as an argument (and returns a Num)
# abs_num (Num.Int 4);;
- : Num.num = Int 4

And it's Num.Int and not Num.int (it is a constructor, not a function).



Le 21/07/2013 12:47, zech.ph@gmail.com a écrit :
> Hi,
>
> I'm new to OCaml and already struggling around with the seemingly easiest
> things.
> Following some introductory texts I wanted to play around a little with the
> toplevel and its various features, among others, using provided modules. For
> this, I thought about loading nums.cma and try some of its defined functions,
> but it just does not work. See below for what I do in the toplevel and the
> respective output.
>
>> ocaml
>          OCaml version 4.00.1
> # #load "nums.cma";;
> # abs_num 4;;
> Error: Unbound value abs_num
> # abs 4;;
> - : int = 4
>
> >From my point it looks like I do not miss anything, yet, I just can't call
> abs_num. And I don't know why. I'm working on a Fedora 19 x64. I checked
> Bugzilla, but couldn't find any Fedora related issues (at least for this
> behavior).
>
> Thanks for any help,
>
> Phil
>
> PS: I know about the beginner's list at yahoo, however, I chose this one as I
> don't like their style of forced social integration using different
> services...I hope this is ok...
>


  parent reply	other threads:[~2013-07-21 11:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21 10:47 zech.ph
2013-07-21 11:25 ` David Allsopp
2013-07-21 11:33 ` Jean-Marc Alliot [this message]
2013-07-21 11:44 ` zech.ph
2013-07-21 11:45   ` zech.ph

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=51EBC722.90609@irit.fr \
    --to=jean-marc.alliot@irit.fr \
    --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