Advertisement
Guest User

org-mode babel and literate

a guest
Jun 16th, 2012
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #+title: Test of Literate Programming
  2.  
  3. #--------------------------------------------------------
  4. #COLLECTION
  5. #--------------------------------------------------------
  6. #Below I have a collection of several hello world !
  7. #I don't want to execute them neither show the source now
  8.  
  9. #+name: cpp_hello_world
  10. #+begin_src C++ -n :exports none
  11. #include <iostream>
  12.  
  13. int main(int argc, char ** argv)
  14. {
  15. std::cout << "Hello World !" << std::endl;
  16. std::cout << "fglkjfglk" << std::endl;
  17. std::cout << "dkfjdfkjdkdjfkdjfkdfjdkf" << std::endl;
  18. return 0;
  19. }
  20. #+end_src
  21.  
  22. #+name: haskell_hello_world
  23. #+begin_src haskell -n :exports none
  24. [1..10]
  25. putStrLn "Hello World !"
  26. #+end_src
  27.  
  28. #+name: r_hello_world
  29. #+begin_src R -n :exports none
  30. x <- 1:5
  31. print(x)
  32. print("Hello World !")
  33. #+end_src
  34. #--------------------------------------------------------
  35. #END COLLECTION
  36. #--------------------------------------------------------
  37.  
  38. * Hello Word in C++
  39. Here is the source code :
  40. #+call: cpp_hello_world [:exports code]
  41. and here is the result :
  42. #+call: cpp_hello_world [:results output :exports results]
  43.  
  44. * Hello World in Haskell
  45. Here is the source code :
  46. #+call: haskell_hello_world [:exports code]
  47. and here is the result :
  48. #+call: haskell_hello_world [:results output :exports results]
  49.  
  50. * Hello World in R
  51. Here is the source code :
  52. #+call: r_hello_world [:exports code]
  53. and here is the result :
  54. #+call: r_hello_world [:results output :exports results]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement