Skip to content
This repository
tag: v1367
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 195 lines (140 sloc) 3.647 kb
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
val f = 0 + 1;;

val f = (@client(0)) + (@server(1));;
val f = (@server(0)) + (@client(1));;

val f = let x = @client(0) in @server(x + 1);;

val f x = let x2 = @client(x) in @server( {foo=x; bar=x2} );;

val f x = {foo=@client(0); bar=@server(2)};;

val f x = {foo=@client(0); bar=@server(x + 2)};;

val f x = @server({foo=0; bar=2});;
val g = @client(f)

val f x = @server({foo=@client(0); bar=2});;

val g x = x + 1;;
val f x = @client(1 + @server(g x));; (* todo optimiser ca*)

val f = @server(4)
val g = @client(f)

val /db : int intmap
val g x = @client( let out = !/db/x in out);;

val str_concat a b = a;;
val md5 x = x;;
val insert_password = (* todo : faire en sorte que password ne se balade pas chez le client...*)
  @server(
    let current_client = "current_user"
    and password = str_concat "ma graine " @client("toto_dans_champ_input")
    in (* /db/current_client/password = *) md5 password
  )


val f =
  @server(
  let a = 1
  and b = 1 + @client(2)
  in a + b
  )


val f z = match @client(z) with
  | {x; y} -> (@server(x)) + (@client(x + y))
  | {x_y} -> x_y

val f x y z = (@client(x)) + (@server(y)) + z


val x = (* todo optimiser ca*)
  @server({
    foo={ a = 1; b = 2; c = @client(3); d = @server(4)};
    bar={a=1}
  })

val f = @server( {x=1} :: {x=@client(1)} );;

val /db : int intmap
val g x = @server(
  let x2 = 4 in
  let /db/x = @client(4) in
  let /db/x2 = @client(5) in
  1155
);;

val f = @client(
  let x = @server(
      {
        foo = @client(0);
        bar = 4;
        blah = let x2 = 1 in @client(x2)
      }.blah
    ) in x + 1
  );;

val /db : int intmap
val f =
  let x0 = @client(0) in
  let x1 = x0 + 1 in
  @server(let v0 = /db/x0
  and v1 = /db/x1 in
  @client(v0 + v1));;

val rec fact x =
  @client(match x with
  | 0 -> @client(1)
  | n -> @server( n * @client((fact (n - 1) ) )))
;;

val rec g x = f (@client(1) + x)
and f x0 = g (@server(1) + x0);;

val rec f x = g (@server(1) + x)
and g x0 = f (@client(1) + x0);;

val g x = x + 1;;
val pipe x0 f = @server(f x0) ;;
val x = @client( pipe 1 g );;

val f x = @server(x)
val g x0 = x0 + 1
val h x1 = @client(x1 + 2)
val i = [f;g;h]

val g x = @server( x + 1);;
val pipe x0 f = @client(f x0) ;;
val x = pipe 1 g;;

type 'a list = {hd : 'a ; tl : 'a list} / {nil : unit};;
val g x0 = @server( x0 + 1);;
val rec map f li = @client(
  match li with
  | { hd; tl } -> {hd = f hd; tl = map f tl}
  | { nil } -> li
);;
val li = [1;2;3;4;5;6;7;8;9;10];;
val x = map g li;;

val g x y z = @client( 1 + @server( z - (x + y) * x - y))

val /db : int
val jquery_get_val_truc = @client(4)
val f =
   @server(
    let _ = @/db <- 1
    and titi = 2 in
    let toto = @client(let out = @server(let /db = jquery_get_val_truc in ()) in out ) in
    let _ = @/db <- 5 in ()
  )

val add y z = 1
val foo =
  let x = @client(add)
  in @server(x 0 1)


val add_client y z = 1
val foo = let f = add_client 0 in @server(f 1)


val f =
@server({
  a = @client(1 + 0);
  b = @server(1 + 1);
  c = @client(1 + 2);
  d = @server(1 + 3);
  e = @server(1 + 4);
  f = @client(1 + 5);
  g = @server(1 + 6)
})


val rec f x = g (x + 1)
and h x2 = f x2
and g x3 = h x3;;

val x =
  { value=@side_specific( {f1=5; f2=9} ) };;

val x =
  @client({ value=@side_specific( {f1=5; f2=9} ) });;

val x =
  @server({ value=@side_specific( {f1=5; f2=9} ) });;

val do_not_slice = 5
val x = do_not_slice


val plus x y = x;;

val f x = @client( plus 1 x);;

val g f x = plus x @server(1);;

val h = g f 0;;



val f x y = @server(0)
val k = @server(1)
val g x =
  let y = @client(x) in
  f k y




val /db : int intmap
val add x y = y
val g x = @/db/x <- @client( add x 1 ) ;;
Something went wrong with that request. Please try again.