Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. (password, username) = GetUsernameAndPassword()
  2.  
  3. let s = "1"
  4. match tryParse s with
  5. | Some(i) -> // do whatever with i
  6. | None -> // failed to parse
  7.  
  8. let foo = (1, 2, 3)
  9.  
  10. let (one, two, three) = foo
  11.  
  12. one
  13. -- > 1
  14.  
  15. three
  16. -- > 3
  17.  
  18. sub foo { 1, 2, 3 }
  19.  
  20. my ($one, $two, $three) = foo
  21.  
  22. $one
  23. # > 1
  24.  
  25. $three
  26. # > 3
  27.  
  28. SP + 8: param 2
  29. SP + 6: param 1
  30. SP + 4: return address
  31. SP + 2: local 2
  32. SP + 0: local 1
  33.  
  34. f :: Int -> (Int, Int)
  35. f x = (x - 1, x + 1)
  36.  
  37. // Even C++ have tuples - see Boost.Graph for use
  38. std::pair<int, int> f(int x) {
  39. return std::make_pair(x - 1, x + 1);
  40. }
  41.  
  42. data MyValue = MyValue Int Int
  43.  
  44. g :: Int -> MyValue
  45. g x = MyValue (x - 1, x + 1)
  46.  
  47. int x;
  48.  
  49. int f(out int y) {
  50. x = 0;
  51. y = 1;
  52. printf("%dn", x);
  53. }
  54. f(out x);
  55.  
  56. x = n + sqrt(y);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement