Skip to content

Instantly share code, notes, and snippets.

@squadette
Created November 28, 2012 16:44
Show Gist options
  • Save squadette/4162450 to your computer and use it in GitHub Desktop.
Save squadette/4162450 to your computer and use it in GitHub Desktop.
set_prev_next [t] -> [(t, t, t)] # (value, prev, next)
set_prev_next xs = set_prev nil xs
set_prev p x:xs = (x, p, next_of xs) : set_prev x xs
set_prev p [] = []
next_of x:xs = x
next_of [] = nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment