~jojo/Carth

ref: 58f475edcf63ad30f0aafd711da977e4ba317bf2 Carth/examples/literate.org -rw-r--r-- 683 bytes
58f475edJoJo Literate programming: Compile .org by untangling carth src blocks 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#+TITLE: Literate Programming Rules!

Literate programming is just really cool!

~carth~ will assume ~tangle~ = ~yes~ by default, but setting it
explicitly won't hurt.

#+BEGIN_SRC carth :tangle yes
(define (main _)
  (printInt (id 1337)))
#+END_SRC

* The ~id~ function
  ~id~ is the identity function. It returns its argument unchanged.

  #+BEGIN_SRC carth
  (define (id x) x)
  #+END_SRC

* How not to use ~id~
  Here is an example of how not to use ~id~. Note that this won't
  compile. We show this in a SRC block to get syntax highlighting etc,
  but as ~tangle~ is ~no~, this source block will be ignored by carth.

  #+BEGIN_SRC carth :tangle no
  (printInt id)
  #+END_SRC