From 15e68d2dcc9671d949c4c325fa0cf0385aa99884 Mon Sep 17 00:00:00 2001 From: Jacob Signorovitch Date: Fri, 10 Oct 2025 01:10:31 -0400 Subject: [PATCH] Updated again. --- 02-trees/main.rkt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/02-trees/main.rkt b/02-trees/main.rkt index baee183..d4c28bf 100644 --- a/02-trees/main.rkt +++ b/02-trees/main.rkt @@ -21,13 +21,15 @@ ; Tree t -> Bool ; Determines whether a Tree is a binary search tree. (define (bst? t) - (local [; Convenient form of greater than. + (local [; <2: U{Num, Sym}, Num, U{Num, Sym} → Bool + ; Convenient form of greater than. Slightly hack. (define (<2 a b c) (cond [(and (symbol? a) (symbol? c)) #t] [(symbol? a) (< (- b 1) b c)] [(symbol? c) (< a b (+ b 1))] [else (< a b c)])) + ; recurse: t: Tree, lower: Num, upper: Num → Bool ; Recursively checks left & right with lower & upper bounds. (define (recurse t lower upper) (cond [(symbol? t) (symbol=? t 'end)]