# open Std;;
Characters 0-8:
open Std;;
^^^^^^^^
Error: Unbound module Std
Run in the ocaml interpreter. I had previously installed ocaml-extlib-devel and ocaml-extlib. What else do I need to do to get the module installed?
(I'm working on RedHat Linux, FC-18).
What you need to do is:
#use "topfind";;
#require "extlib";;
You need to type those #, in additional to the prompt, because those are toplevel directives. They use the library findlib which also provides the ocamlfind tool and is probably installed in your OCaml environment (otherwise you should get it installed). It knows where to find ocaml packages in your filesystem.
Related
I want to use the Graphics modules that I installed on my machine with opam but it didn't recognized it, i have the output :
1 | let open Graphics in
^^^^^^^^
Error: Unbound module Graphics
when i run ocaml main.ml, even if my file starts with :
#use "topfind"
I'have tried reinstalling it multiple times, and i checked, it's correctly install in /home/me/.opam/default/lib/graphics.
I'm using Debian with ocaml 4.14
An opam package contains one (or sometimes more) libraries which themselves contain many modules (or sometimes only one module).
In the case of graphics, the opam package only contains the graphics library. To access the module of the library, you need to tell the REPL(toplevel) that you intend to use the graphics library with
#require "graphics";
then you will be able to use the Graphics module from the graphics library.
Note that outside of scripts, the information of which libraries to use should be part of the description of your project. If you are using dune (aka the recommended build system for OCaml), this means adding
(libraries graphics)
to your dune file.
I've got a very simple program which lists all .txt files in a given directory. This program has run perfectly on my Mac which has the Rakudo Star version 2019.03.1
use File::Find;
my $folder="../Documents";
.say for find dir => $folder, name => /'.txt' $/;
When I've tried to run the same program on Windows 7 which had Raku 2020.12.1 it gave this:
$ raku html-adder.rk
===SORRY!=== Error while compiling C:\Users\lars\raku/html-adder.rk
Could not find File::Find in:
inst#C:\Users\lars\.raku
inst#C:\Programs\rakudo-moar-2021.02.1\share\perl6\site
inst#C:\Programs\rakudo-moar-2021.02.1\share\perl6\vendor
inst#C:\Programs\rakudo-moar-2021.02.1\share\perl6\core
ap#
nqp#
perl5#
at C:\Users\lars\raku/html-adder.rk:12
I've updated the Raku to version Raku 2021.02.1 and the same error again. I've installed it by unzipping the rakudo-moar-2021.02.1-01-win-x86_64-msvc.zip i.e. without using any installer. And as regards to the Raku on Mac, I don't remember installing the File::Find module, nor do I know how to list the installed modules, i.e. I haven't checked if File::Find was installed on Mac or Windows 7.
How to make this program work on Windows 7?
File::Find is not built into Raku or distributed with Rakudo Star; to my knowledge, it never has been.
It is a module in the ecosystem that you can install with Zef (use the command zef install File::Find).
It is also a very short library. If you are interested in fixing your script without adding a dependency, you may want to check out the source code for File::Find; it is short enough that you could easily implement the same functionality yourself.
I want to do something like this:
die "Fatal error: application version $MY-APPLICATION-VERSION"
Since a Perl6 module cannot assume the relative locations of files it was packaged with (for instance installed modules are all put into a flat directory structure) I can't just do $?FILE.IO.add("../META6.json").slurp. Is there a way to get the version declared in META6.json in a Perl6 app/module that may or may not be installed?
As of rakudo v2019.03 modules may access the Distribution object used to load it via $?DISTRIBUTION. This allows the following:
unit module My::Module;
BEGIN my $VERSION = $?DISTRIBUTION.meta<version>;
use My::SubModule:ver($VERSION); # ensure we only ever use the version included in this distribution
die "Fatal error: application version $VERSION"
Is there any command in the Perl6 Rakudo distribution which lists all the installed modules on the system?
I tried the following command:
p6doc NativeCall
and get the following error :
===SORRY!===
Cannot invoke this object (REPR: Uninstantiable)
but when I write a p6 file which contains :
use NativeCall;
it compiles with no problem.
How can I browse for such a Perl 6 module (like perldoc for Perl 5) and how can I list all the installed Perl 6 modules?
The module manager is zef, not p6doc
p6doc ... is meant for managing (searching/displaying) documentation not for managing modules.
zef should already be installed on your system. If not, install it from its github repo.
The error message you got from p6doc suggests something is borked in your installation. I think it's most likely something not worth chasing for another month so I suggest you ignore it for a month, make sure you're running an up-to-date Perl 6 distribution (eg the latest Rakudo Star), and then, if it's still around, consider speaking up about it on #perl6 and mentioning this closed bug report.
Hth.
zef is your (best) friend in Perl6 universe.
zef --help
will give you any information you have ever wish aboutZef and how to use it and therefore any information about any installed modules.
zef list --installed
If you are looking for a specific module, you can use:
zef search module
in the list returned, you'll see in the first lines:
Zef::Repository::LocalCache... Module
...
which gives you a list of installed modules related to your question.
I would like to use the OcalIDE plugin to have Ocaml in my Eclipse.
I had installed the ocaml-3.12.0-intel on my Mac and then OcalIDE plugin. But I couldn't make it finish as my Ocaml paths are all undefined.
I know my Ocaml package was installed at /usr/local/lib/ocaml as default, but the preference keep popping value must be an existing file error and I have no idea what was going wrong.
Any help from the floor?
If you installed OCaml in the standard locations, the path should be filled automatically. You can check in:
Window > Preferences > OcaIDE > Paths
Check also this really good tutorial : http://www.algo-prog.info/ocaide/tutorials/1-installing/installing.htm