-
Notifications
You must be signed in to change notification settings - Fork 23
Examples Guide
Shaun LeBron edited this page Jun 29, 2015
·
2 revisions
Some thoughts:
- We want readers to quickly get at the essence of how to use the symbol.
- Examples should be simple.
All examples are licensed as CC0, same as clojuredocs and grimoire.
Here are some styling rules for keeping docs consistent:
(expression)
;;=> result
(invalid-expression)
;; ERROR: message
(invalid-expression)
;; WARNING: message
(printing-expression)
;; Prints:
;; line1
;; line2
;;=> result
Don't show the result of an expression unless you think it's important. For example, (def a 12)
return 12, but we don't show it.
(def a 12)
a
;;=> 12
Since examples are markdown-formatted, you can intersperse text.
```
(assoc {} :foo "bar")
;;=> {:foo "bar"}
```
Some text to explain another usage:
```
(assoc {} :a "b" :c "d)
;;=> {:a "b" :c "d"}
```
No set rules for when to do this yet, but we prefer this over writing long comments in code blocks.
Examples are uniquely identified by a 6 digit hash:
>> Example template with random ID generator
===== Example#387a62
```
(markdown code block. write code here!)
```
A single example section can have multiple example expressions, of course. But we can also include multiple sections.
===== Example#a46c8f
```
(conj [] "foo")
;;=> ["foo"]
(apply conj [] "foo" "bar")
;;=> ["foo" "bar"]
```
some text here, and then another code block
```
(conj #{} "foo")
;;=> #{"foo"}
```
===== Example#bfd2a4
```
more advanced example here?
```
No set rules for choosing when to separate examples into different sections