Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
3843b605
Commit
3843b605
authored
Aug 25, 2014
by
Julien Lopez
Browse files
Add missing files
parent
b1e7cb6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/ocaml/poly/clist.cd
0 → 100644
View file @
3843b605
let clength (l : ['a*]) : Int =
let aux (l : ['a*])(res : Int) : Int = match l with
| [] -> res
| [_; rest] -> aux rest (res + 1) in
aux l 0
let olength = List.length with {'a}
let chd (['a*] -> 'a)
| [] -> raise "Invalid_argument \"Clist.hd\""
| [el _*] -> el
let ohd = List.hd with {'a}
let ctl (['a*] -> ['a*])
| [] -> raise "Invalid_argument \"Clist.hd\""
| [_; rest] -> rest
let otl = List.tl with {'a}
let cnth (l : ['a*])(n : Int) : 'a =
let aux (l : ['a*])(n : Int) : 'a = match l with
| [] -> raise "Failure \"Clist.nth\""
| [el; rest] -> if n >> 0 then aux rest (n - 1) else el in
if n << 0 then raise "Invalid_argument \"Clist.nth\"" else aux l n
let onth = List.nth with {'a}
let crev (l : ['a*]) : ['a*] =
let aux (l : ['a*])(res : ['a*]) : ['a*] = match l with
| [] -> res
| [el; rest] -> aux rest ([el] @ res) in
aux l []
let orev = List.rev with {'a}
tests/ocaml/poly/clist.mli
0 → 100644
View file @
3843b605
val
clength
:
'
a
list
->
Big_int
.
big_int
val
olength
:
'
a
list
->
int
val
chd
:
'
a
list
->
'
a
val
ohd
:
'
a
list
->
'
a
val
ctl
:
'
a
list
->
'
a
list
val
otl
:
'
a
list
->
'
a
list
val
cnth
:
'
a
list
->
Big_int
.
big_int
->
'
a
val
onth
:
'
a
list
->
int
->
'
a
val
crev
:
'
a
list
->
'
a
list
val
orev
:
'
a
list
->
'
a
list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment