Rework `flow' module doc
- Reworded intro a bit - Cleaned up white space - Reworded examples
This commit is contained in:
parent
4642625378
commit
4fe67c11a4
@ -4,8 +4,7 @@ Flow
|
|||||||
|
|
||||||
.. versionadded:: 0.10.1
|
.. versionadded:: 0.10.1
|
||||||
|
|
||||||
The ``flow`` macros allow a programmer to direct the flow of his program with
|
The ``flow`` macros allow directing the flow of a program with greater ease.
|
||||||
greater ease.
|
|
||||||
|
|
||||||
|
|
||||||
Macros
|
Macros
|
||||||
@ -28,11 +27,11 @@ Example:
|
|||||||
|
|
||||||
(require hy.contrib.flow)
|
(require hy.contrib.flow)
|
||||||
|
|
||||||
(defn bmi-commenter [bmi]
|
(defn temp-commenter [temp]
|
||||||
(case bmi
|
(case temp
|
||||||
10 (print "The bmi was 10, wow.")
|
-10 (print "It's freezing. Turn up the thermostat!")
|
||||||
20 (print "20? Really?")
|
15 (print "Sounds about average.")
|
||||||
30 (print "Was it 30? Ok...")
|
45 (print "Holy smokes. It's hot in here!")
|
||||||
(print "I don't even know.")))
|
(print "I don't even know.")))
|
||||||
|
|
||||||
|
|
||||||
@ -51,10 +50,9 @@ Example:
|
|||||||
|
|
||||||
(require hy.contrib.flow)
|
(require hy.contrib.flow)
|
||||||
|
|
||||||
(defn bmi-commenter [bmi]
|
(defn temp-commenter [temp]
|
||||||
(switch bmi
|
(switch temp
|
||||||
(<= 18.5) (print "you are underweight!")
|
(<= 10.0) (print "Better wear a jacket!")
|
||||||
(<= 25.0) (print "apparently normal")
|
(<= 25.0) (print "Brace yourselves. Summer is coming!")
|
||||||
(<= 30.0) (print "a little too heavy, but ok")
|
(<= 30.0) (print "Time to get some ice cream.")
|
||||||
(print "You are a whale!")))
|
(print "Sounds like a heat wave")))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user