Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's impossible to write a compose function with the declaration

  fn compose<T, F: Fn(T) -> T>(f1: F, f2: F) -> F
As far as I'm aware the only way to write a function like that is

  fn compose<T, F: Fn(T) -> T>(f1: F, f2: F) -> F {
    f1
  }
and even then you can only call it like this

  let clos = |x| 2 * x;
  compose(clos, clos);


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: