Skip to content

Commit c47d6e7

Browse files
leafacrfindler
authored andcommitted
Add documentation about literal terms
1 parent bff32bc commit c47d6e7

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

redex-doc/redex/scribblings/ref/terms.scrbl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ stands for repetition unless otherwise indicated):
2929
(in-hole term term)
3030
hole
3131
(mf-apply identifier term ...)
32-
#t #f
33-
string]
32+
literal]
3433
[term-sequence
3534
term
3635
,@expr
@@ -64,8 +63,15 @@ them.}
6463
@item{A term written @racket[(mf-apply f arg ...)] asserts that @racket[f]
6564
is a @tech{metafunction} and produces the term @racket[(f arg ...)].}
6665

67-
@item{A term written as a literal boolean or a string
68-
produces the boolean or the string.}
66+
@item{A term written as a literal produces that literal.
67+
Term substitution and metafunction application do not occur
68+
within literal values. For example,
69+
70+
@racketblock[
71+
(term-let ([a 1]) (term #hash((x . a))))
72+
]
73+
74+
Evaluates to @racket['#hash((x . a))], not @racket['#hash((x . 1))].}
6975
]
7076

7177
@defform*[[(term @#,tttterm) (term @#,tttterm #:lang lang-id)]]{

redex-test/redex/tests/term-test.rkt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
(test (term (1 ,(+ 1 1))) (list 1 2))
1414
(test (term-let ([x 1]) (term (x x))) (list 1 1))
1515
(test (term-let ([(x ...) (list 1 2 3)]) (term ((y x) ...))) '((y 1) (y 2) (y 3)))
16+
(test (term #hash((a . 2))) #hash((a . 2)))
17+
(test (term-let ([x 1]) #hash((a . x))) #hash((a . x)))
18+
(test (term #s(a 2 3 4)) #s(a 2 3 4))
19+
(test (term-let ([x 1]) #s(a 2 x 4)) #s(a 2 x 4))
1620

1721
(test (term (in-hole (1 hole) 2)) (term (1 2)))
1822
(test (term (in-hole (1 hole (hole x)) 2)) (term (1 2 (hole x))))

0 commit comments

Comments
 (0)