Advertisement
tinyevil

Untitled

Nov 14th, 2018
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. template[F]
  2. function sin(x:F): F;
  3.  
  4. template[F]
  5. function cos(x:F): F;
  6.  
  7. template[F]
  8. function sincos(x:F): Pair[F,F]
  9. where sin[F], cos[F]
  10. {
  11.     return {sin(x), cos(x)};
  12. }
  13.  
  14. instance sin[double](x:double):double{
  15.     // ...
  16. }
  17.  
  18. instance cos[double](x:double):double{
  19.     // ...
  20. }
  21.  
  22. function main():int{
  23.     // looks up sin[double] and cos[double]
  24.     let sc = sincos(1.0);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement