summaryrefslogtreecommitdiff
path: root/src/vylist.ml
blob: c7d039678b2bfc60c3038556ae4578bb61eac6a1 (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')