File: ref.liq

package info (click to toggle)
liquidsoap 2.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,844 kB
  • sloc: ml: 74,136; javascript: 27,320; ansic: 505; sh: 139; xml: 114; lisp: 96; makefile: 26
file content (25 lines) | stat: -rw-r--r-- 332 bytes parent folder | download | duplicates (2)
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
#!../../liquidsoap ../test.liq

def id(x) =
  x
end

def incr(n) =
  n + 1
end

def f() =
  n = ref(0)
  n := 5
  test.equal(n(), 5)
  s = ref("a")
  s := "b"
  test.equal(s(), "b")
  f = ref(id)
  f := incr
  r = ref.make({0}, fun (x) -> ignore(x + 1))
  _ = ref.map(float_of_int, int_of_float, r)
  test.pass()
end

test.check(f)