Snippets

Cameron Presley Removing first occurrence of an element from a list

Created by Cameron Presley
1
2
3
4
let rec removeFirst elements value =
    match elements with
    | [] -> []
    | head::tail -> if head = value then tail else head::removeFirst tail value

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.