package ocaml-r

  1. Overview
  2. Docs

Source file OCamlR_base_stubs2.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
open OCamlR

let id x = x

module Symbol = struct
  let length = symbol ~generic:true "length"

  let dim = symbol ~generic:true "dim"

  let subset = symbol ~generic:true "["

  let subset2 = symbol ~generic:true "[["

  let rle = symbol ~generic:true "rle"

  let sample = symbol ~generic:true "sample"

  let min = symbol ~generic:true "min"

  let max = symbol ~generic:true "max"
end

let length l = call Symbol.length [ arg id l ]

let dim x =
  call Symbol.dim [ arg id x ]

let subset x i = call Symbol.subset [
    arg id x ;
    arg id i ;
  ]

let subset_ii x i j = call Symbol.subset [
    arg id x ;
    arg id i ;
    arg id j ;
  ]


let subset2_i x i = call Symbol.subset2 [
    arg id x  ;
    arg id i
  ]

let subset2_s = subset2_i

module Matrix = struct
  let subset = subset
  let subset_ii = subset_ii
  let subset2 = subset2_i
end

let rle x = call Symbol.rle [ arg id x ]

let sample x n ?replace ?prob () =
  call Symbol.sample [
    arg id x ;
    arg id n ;
    opt_arg id "replace" replace ;
    opt_arg id "prob" prob
  ]

let min x = call Symbol.min [ arg id x ]
let max x = call Symbol.max [ arg id x ]

OCaml

Innovation. Community. Security.