Open siadat opened 3 months ago
One of the Racket listings is missing a closing paren.
This PR adds the missing paren.
make
\def\racketEd{1}
#lang racket
(struct Int (value)) (struct Prim (op args)) (struct Program (info body)) (define rd (Prim 'read '())) (define neg-eight (Prim '- (list (Int 8)))) (define ast1_1 (Prim '+ (list rd neg-eight)))
(define (is_exp ast) (match ast [(Int n) #t] [(Prim 'read '()) #t] [(Prim '- (list e)) (is_exp e)] [(Prim '+ (list e1 e2)) (and (is_exp e1) (is_exp e2))] [(Prim '- (list e1 e2)) (and (is_exp e1) (is_exp e2))] [else #f]))
(define (is_Lint ast) (match ast [(Program '() e) (is_exp e)] [else #f]))
(is_Lint (Program '() ast1_1)) (is_Lint (Program '() (Prim '* (list (Prim 'read '()) (Prim '+ (list (Int 8)))))))
It returns
$ racket Lint.rkt
Issue
One of the Racket listings is missing a closing paren.
Solution
This PR adds the missing paren.
Verification
make
with\def\racketEd{1}
(struct Int (value)) (struct Prim (op args)) (struct Program (info body)) (define rd (Prim 'read '())) (define neg-eight (Prim '- (list (Int 8)))) (define ast1_1 (Prim '+ (list rd neg-eight)))
(define (is_exp ast) (match ast [(Int n) #t] [(Prim 'read '()) #t] [(Prim '- (list e)) (is_exp e)] [(Prim '+ (list e1 e2)) (and (is_exp e1) (is_exp e2))] [(Prim '- (list e1 e2)) (and (is_exp e1) (is_exp e2))] [else #f]))
(define (is_Lint ast) (match ast [(Program '() e) (is_exp e)] [else #f]))
(is_Lint (Program '() ast1_1)) (is_Lint (Program '() (Prim '* (list (Prim 'read '()) (Prim '+ (list (Int 8)))))))
$ racket Lint.rkt
t
f