From dba849ae62e78b33f1672a66676db12786178138 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 10 Sep 2019 17:11:38 -0400 Subject: [PATCH] Build-out validation --- validation.scm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/validation.scm b/validation.scm index 4bf75d87..d4999a61 100644 --- a/validation.scm +++ b/validation.scm @@ -24,15 +24,23 @@ (error "Too many arguments" exp))))) (define (check-define exp) - 'todo) + (let ((args (length exp))) + (cond + ((< args 2) + (error "Not enough arguments" exp))))) (define (check-set exp) - 'todo) + (let ((args (length exp))) + (cond + ((< args 2) + (error "Not enough arguments" exp))))) (define (check-lambda exp) - ;(difference (reduce union (map search (lambda->exp exp)) '()) - ; (lambda-formals->list exp)) - 'todo) + (let ((num-args (length exp))) + (cond + ((< num-args 2) + (error "Not enough arguments" exp)))) + (lambda-formals-type exp)) ;; Validates type information ;; TODO: could check primitives, etc