~jojo/Carth

ref: 3f71c019bc3fd13360c650cd69e5e211660db158 Carth/examples/literate.org -rw-r--r-- 788 bytes
3f71c019JoJo Delay StartNotDefined error until after typechecking 1 year, 10 months 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
28
29
30
31
32
33
#+TITLE: Literate Programming Rules!

Literate programming is just really cool!

First we import the standard library.

#+BEGIN_SRC carth
(import std)
#+END_SRC

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

#+BEGIN_SRC carth :tangle yes
(define (start _)
  (display (id "Literate programming rules!")))
#+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
  (display id)
  #+END_SRC