It is easy to see from this table that the every even number is
A true (lazy) mathematician would also replace <#65820#><#31172#>make-even<#31172#><#65820#> and
<#65821#><#31173#>make-odd<#31173#><#65821#> by their definitions, <#31174#>i.e.<#31174#>, <#71414#>;; <#65800#><#30955#>make-even<#30955#> <#30956#>:<#30956#> <#30957#>N<#30957#> <#30958#><#30958#><#30959#>-;SPMgt;<#30959#><#30960#><#30960#> <#30961#>N<#30961#><#30962#>[<#30962#><#30963#>even]<#30963#><#65800#><#71414#>
<#71415#>;; to compute the <#65801#><#30964#>i<#30964#><#65801#>-th even number<#71415#>
<#30965#>(d<#30965#><#30966#>efine<#30966#> <#30967#>(make-even<#30967#> <#30968#>i)<#30968#>
<#30969#>(*<#30969#> <#30970#>2<#30970#> <#30971#>i))<#30971#>
<#71416#>;; <#65802#><#30977#>make-odd<#30977#> <#30978#>:<#30978#> <#30979#>N<#30979#> <#30980#><#30980#><#30981#>-;SPMgt;<#30981#><#30982#><#30982#> <#30983#>N<#30983#><#30984#>[<#30984#><#30985#>odd]<#30985#><#65802#><#71416#>
<#71417#>;; to compute the <#65803#><#30986#>i<#30986#><#65803#>-th odd number<#71417#>
<#30987#>(d<#30987#><#30988#>efine<#30988#> <#30989#>(make-odd<#30989#> <#30990#>i)<#30990#>
<#30991#>(+<#30991#> <#30992#>(*<#30992#> <#30993#>2<#30993#> <#30994#>i)<#30994#> <#30995#>1))<#30995#>
In short, functions from natural numbers to numbers are representations of
infinite sequences.
A mathematical <#30999#>series<#30999#> is the sum of a sequence. The three finite
sequences have the sums 20, 25, and 75, respectively. In the case of
infinite sequences it is often interesting to consider a finite portion,
staring with the first one.<#71418#>;; <#65807#><#31008#>series-even<#31008#> <#31009#>:<#31009#> <#31010#>N<#31010#> <#31011#><#31011#><#31012#>-;SPMgt;<#31012#><#31013#><#31013#> <#31014#>number<#31014#><#65807#><#71418#>
<#71419#>;; to sum up the first
;; <#65808#><#31015#>n<#31015#><#65808#> even numbers<#71419#>
<#31016#>(d<#31016#><#31017#>efine<#31017#> <#31018#>(series-even<#31018#> <#31019#>n)<#31019#>
<#31020#>(c<#31020#><#31021#>ond<#31021#>
<#31022#>[<#31022#><#31023#>(=<#31023#> <#31024#>n<#31024#> <#31025#>0)<#31025#> <#31026#>(make-even<#31026#> <#31027#>n)]<#31027#>
<#31028#>[<#31028#><#31029#>else<#31029#> <#31030#>(+<#31030#> <#31031#>(make-even<#31031#> <#31032#>n)<#31032#>
<#31033#>(series-even<#31033#> <#31034#>(-<#31034#> <#31035#>n<#31035#> <#31036#>1)))]<#31036#><#31037#>))<#31037#>
<#71420#>;; <#65809#><#31043#>series-odd<#31043#> <#31044#>:<#31044#> <#31045#>N<#31045#> <#31046#><#31046#><#31047#>-;SPMgt;<#31047#><#31048#><#31048#> <#31049#>number<#31049#><#65809#><#71420#>
<#71421#>;; to sum up the first
;; <#65810#><#31050#>n<#31050#><#65810#> odd numbers<#71421#>
<#31051#>(d<#31051#><#31052#>efine<#31052#> <#31053#>(series-odd<#31053#> <#31054#>n)<#31054#>
<#31055#>(c<#31055#><#31056#>ond<#31056#>
<#31057#>[<#31057#><#31058#>(=<#31058#> <#31059#>n<#31059#> <#31060#>0)<#31060#> <#31061#>(make-odd<#31061#> <#31062#>n)]<#31062#>
<#31063#>[<#31063#><#31064#>else<#31064#> <#31065#>(+<#31065#> <#31066#>(make-odd<#31066#> <#31067#>n)<#31067#>
<#31068#>(series-odd<#31068#> <#31069#>(-<#31069#> <#31070#>n<#31070#> <#31071#>1)))]<#31071#><#31072#>))<#31072#>
The two functions are natural candidates for abstraction and here is the
result of following our basic abstraction recipe:
<#71422#>;; <#65811#><#31080#>series<#31080#> <#31081#>:<#31081#> <#31082#>N<#31082#> <#31083#>(<#31083#><#31084#>N<#31084#> <#31085#><#31085#><#31086#>-;SPMgt;<#31086#><#31087#><#31087#> <#31088#>number)<#31088#> <#31089#><#31089#><#31090#>-;SPMgt;<#31090#><#31091#><#31091#> <#31092#>number<#31092#><#65811#><#71422#>
<#71423#>;; to sum up the first <#65812#><#31093#>n<#31093#><#65812#> numbers in the sequence <#65813#><#31094#>a-term<#31094#><#65813#>,<#71423#>
<#31095#>(d<#31095#><#31096#>efine<#31096#> <#31097#>(series<#31097#> <#31098#>n<#31098#> <#31099#>a-term)<#31099#>
<#31100#>(c<#31100#><#31101#>ond<#31101#>
<#31102#>[<#31102#><#31103#>(=<#31103#> <#31104#>n<#31104#> <#31105#>0)<#31105#> <#31106#>(a-term<#31106#> <#31107#>n)]<#31107#>
<#31108#>[<#31108#><#31109#>else<#31109#> <#31110#>(+<#31110#> <#31111#>(a-term<#31111#> <#31112#>n)<#31112#>
<#31113#>(series<#31113#> <#31114#>(-<#31114#> <#31115#>n<#31115#> <#31116#>1)<#31116#> <#31117#>a-term))]<#31117#><#31118#>))<#31118#>
The first argument specifies where the addition starts. The second
argument of <#65814#><#31122#>series<#31122#><#65814#> is a function that maps a natural number to the
corresponding term in the series. To test <#65815#><#31123#>series<#31123#><#65815#>, we apply it to
<#65816#><#31124#>make-even<#31124#><#65816#> and <#65817#><#31125#>make-odd<#31125#><#65817#>:
<#71424#>;; <#65818#><#31130#>series-even1<#31130#> <#31131#>:<#31131#> <#31132#>N<#31132#> <#31133#><#31133#><#31134#>-;SPMgt;<#31134#><#31135#><#31135#> <#31136#>number<#31136#><#65818#><#71424#>
<#31137#>(d<#31137#><#31138#>efine<#31138#> <#31139#>(series-even1<#31139#> <#31140#>n)<#31140#>
<#31141#>(series<#31141#> <#31142#>n<#31142#> <#31143#>make-even))<#31143#>
<#71425#>;; <#65819#><#31149#>series-odd1<#31149#> <#31150#>:<#31150#> <#31151#>N<#31151#> <#31152#><#31152#><#31153#>-;SPMgt;<#31153#><#31154#><#31154#> <#31155#>number<#31155#><#65819#><#71425#>
<#31156#>(d<#31156#><#31157#>efine<#31157#> <#31158#>(series-odd1<#31158#> <#31159#>n)<#31159#>
<#31160#>(series<#31160#> <#31161#>n<#31161#> <#31162#>make-odd))<#31162#>
For over a century, mathematicians have used the Greek symbol
<#31177#>Exercise 23.1.1<#31177#>