Skip to content

Instantly share code, notes, and snippets.

@catamorphism
Created March 23, 2011 00:11
Show Gist options
  • Save catamorphism/882380 to your computer and use it in GitHub Desktop.
Save catamorphism/882380 to your computer and use it in GitHub Desktop.
triggers "error: Found non-type binding for list[U]"
fn map[T, U](&list[T] ls, fn(&T t) -> U f) -> list[U] {
fn p(&T t, &list[U] u) -> &list[U] {
ret cons[U](f(t), u);
}
ret list.foldl[T, U](ls, nil, p);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment