summary refs log tree commit diff stats
path: root/doc/aerc-tutorial.7.scd
diff options
context:
space:
mode:
authorLyle Hanson <lyle2.0@gmail.com>2019-06-11 14:11:15 -0500
committerDrew DeVault <sir@cmpwn.com>2019-06-14 09:56:54 -0400
commitd3b5a76b4a8ad839991cb686711a0c0d24536d5e (patch)
tree7987766db72b56cafe59c885f407451de1eb365f /doc/aerc-tutorial.7.scd
parente56ceb099e23cf170750758c67f00713bff1cce1 (diff)
downloadaerc-d3b5a76b4a8ad839991cb686711a0c0d24536d5e.tar.gz
Add uninstall target to Makefile
Also removes leftover directories if there isn't anything else in them.

https://todo.sr.ht/~sircmpwn/aerc2/179
Diffstat (limited to 'doc/aerc-tutorial.7.scd')
0 files changed, 0 insertions, 0 deletions
revious revision' href='/akkartik/mu/blame/factorial.mu?h=main&id=01caf342d072115c27926b1a61c2fc75ab9fbee0'>^
b96af395 ^

ce87c19e ^

bc643692 ^
08b48a8d ^
c1d92c9d ^
ce87c19e ^



b96af395 ^
08b48a8d ^
b96af395 ^


bc643692 ^
b96af395 ^
bafc7192 ^
b96af395 ^


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
34


                                             
             
                         
                          



                  
             
                             

                     

                               
           
   
                             



                                        
 
 


                         
                           
   
                         


            
# example program: compute the factorial of 5

recipe main [
  local-scope
  x:number <- factorial 5
  $print [result: ], x, [ 
]
]

recipe factorial [
  local-scope
  n:number <- next-ingredient
  {
    # if n=0 return 1
    zero?:boolean <- equal n, 0
    break-unless zero?
    reply 1
  }
  # return n * factorial(n-1)
  x:number <- subtract n, 1
  subresult:number <- factorial x
  result:number <- multiply subresult, n
  reply result
]

# unit test
scenario factorial-test [
  run [
    1:number <- factorial 5
  ]
  memory-should-contain [
    1 <- 120
  ]
]