All lessons

Linked Lists

8 min · OCaml examples

Chain nodes with next pointers — traverse, count, and update without shifting a whole array.

OCaml · Linked Lists0/5 cleared

Enemy 1 of 5

OCaml lists are already linked lists: each cell is a head value and a tail list.

Pattern match on Cons (head, tail) or Nil to walk and count nodes.

You
Syntax Skeleton
Loading editor…
Sign up to fightThis one runs on our servers, so it needs a free account.