1:- module(r, [r_initialize/0, r/1, r/2, r_source/2]). 2
3:- use_module(library(rologp)). 4
5:- dynamic r_initialized/0. 6
8r_initialize,
9 r_initialized
10 => true.
11
12r_initialize
13 => pack_property(interval, directory(Dir)),
14 directory_file_path(Dir, 'R', Dir1),
15 r_source(r, Dir1),
16 assert(r_initialized).
17
19r(Expr)
20 => r_call(Expr).
21
23r(Expr, Res)
24 => r_eval(Expr, Res).
25
26r_source(Name, Dir)
27 => file_name_extension(Name, 'R', File),
28 directory_file_path(Dir, File, Path),
29 atom_string(Path, String),
30 r(source(String))