Advertisement
tinyevil

Untitled

Mar 7th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1.  
  2.  
  3. // If n parameter is "computational"
  4.  
  5. struct ListOfSize{
  6. int n;
  7.  
  8. enum {
  9. Empty,
  10. Cons
  11. } tag;
  12.  
  13. union{
  14. //empty
  15.  
  16. //cons
  17. struct{
  18. int m;
  19. bool elt;
  20. ListOfSize* tail;
  21. } cons;
  22. };
  23. };
  24.  
  25. ListOfSize* tail(int n, ListOfSize* ls){
  26. return ls->tail;
  27. }
  28.  
  29. // If n parameter is "non-computational"
  30. // Requires user annotion for n and m
  31.  
  32. struct ListOfSize{
  33. //int n; -- erased
  34.  
  35. enum {
  36. Empty,
  37. Cons
  38. } tag;
  39.  
  40. union{
  41. //empty
  42.  
  43. //cons
  44. struct{
  45. //int m; -- erased
  46. bool elt;
  47. ListOfSize* tail;
  48. } cons;
  49. };
  50. };
  51.  
  52. ListOfSize* tail(/*int n, -- erased */ ListOfSize* ls){
  53. return ls->tail;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement