blob: c63e706134782ace0c0ee0045b607a1bdc9074e1 (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
---input---
#!r6rs
#|
The FACT procedure computes the factorial
of a non-negative integer.
|#
(define fact
(lambda (n)
;; base case
(if (= n 0)
#;(= n 1)
1 ; identity of *
(* n (fact (- n 1))))))
---tokens---
'#!r6rs' Comment
'\n\n' Text
'#|' Comment.Multiline
'\n\n The FACT procedure computes the factorial\n\n of a non-negative integer.\n\n' Comment.Multiline
'|#' Comment.Multiline
'\n\n' Text
'(' Punctuation
'define ' Keyword
'fact' Name.Variable
'\n\n ' Text
'(' Punctuation
'lambda ' Keyword
'(' Punctuation
'n' Name.Function
')' Punctuation
'\n\n ' Text
';; base case' Comment.Single
'\n\n ' Text
'(' Punctuation
'if ' Keyword
'(' Punctuation
'= ' Name.Builtin
'n' Name.Variable
' ' Text
'0' Literal.Number.Integer
')' Punctuation
'\n\n ' Text
'#;(' Comment
'= n 1' Comment
')' Comment
'\n\n ' Text
'1' Literal.Number.Integer
' ' Text
'; identity of *' Comment.Single
'\n\n ' Text
'(' Punctuation
'* ' Name.Builtin
'n' Name.Variable
' ' Text
'(' Punctuation
'fact' Name.Function
' ' Text
'(' Punctuation
'- ' Name.Builtin
'n' Name.Variable
' ' Text
'1' Literal.Number.Integer
')' Punctuation
')' Punctuation
')' Punctuation
')' Punctuation
')' Punctuation
')' Punctuation
'\n' Text
|