Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing close paren in Racket listing #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

siadat
Copy link

@siadat siadat commented May 23, 2024

Issue

One of the Racket listings is missing a closing paren.

Solution

This PR adds the missing paren.

Verification

  • Checked the book.pdf file generated by make with \def\racketEd{1}
  • Checked the following program
#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
#t
#f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant