Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David Allsopp <dra-news@metastack.com>
To: "zech.ph@gmail.com" <zech.ph@gmail.com>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Error: Unbound value abs_num
Date: Sun, 21 Jul 2013 11:25:41 +0000	[thread overview]
Message-ID: <1753C417-01D9-4A8B-9F8A-8256CCC98813@metastack.com> (raw)
In-Reply-To: <sympa.1374403490.23701.296@inria.fr>

zech.ph@gmail.com wrote:

> 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

You need to qualify the identifier or open the module - abs_num is in the Num module (which you've correctly #load'd with nums.cma) so you either say:

Num.abs_num 4;;
or
open Num;;
abs_num 4;;

however you'll then hit another problem - abs_num needs a num not an int so you really mean:

Num.abs_num (Num.Int 4);;

> # 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).

It's unlikely when beginning that you'll hit either a big in OCaml or your distro - better to stick with the assumption that you've made a mistake and ask for help (as you have!)


David

  reply	other threads:[~2013-07-21 11:25 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 [this message]
2013-07-21 11:33 ` Jean-Marc Alliot
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=1753C417-01D9-4A8B-9F8A-8256CCC98813@metastack.com \
    --to=dra-news@metastack.com \
    --cc=caml-list@inria.fr \
    --cc=zech.ph@gmail.com \
    /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