summaryrefslogtreecommitdiff
path: root/src/vylist.ml
blob: c6a10447b2cd8326a1bd5ff4293bff44862c8070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
let rec find p xs =
    match xs with
    | [] -> None
    | x :: xs' -> if (p x) then (Some x)
                  else find p xs'

let rec remove p xs =
    match xs with
    | [] -> []
    | x :: xs' -> if (p x) then xs'
                  else x :: (remove p xs')

let rec replace p x xs =
    match xs with
    | [] -> []
    | x' :: xs' -> if (p x') then x :: xs'
                   else x' :: (replace p x xs')