Skip to content

Instantly share code, notes, and snippets.

@dgfitch
Created June 24, 2009 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgfitch/135349 to your computer and use it in GitHub Desktop.
Save dgfitch/135349 to your computer and use it in GitHub Desktop.
fun (f : 'a * Structure -> 'a * Structure) (state : 'a) (list : Structure list) ->
let g f (state,_) s = f (state, s)
let states, structures =
list
|> List.scan (g f) (state,Empty)
|> List.unzip
// got to be a better way to pop the end off a list
let final_state = states.[List.length states - 1]
final_state, structures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment