joshibharathiramana
2021-3-30 13:53:11

I’m working through software design for flexibility, and am unsure how to translate assertions. More specifically this procedure (define (spread-combine f g h) (let ((n (procedure-arity f)) (m (procedure-arity g))) (let ((t (+ n m))) (assert (= (length args) t)) ; ??? (define (the-combination . args) (h (apply f (take args n)) (apply g (drop args n)))) (procedure-reduce-arity the-combination t))))


joshibharathiramana
2021-3-30 13:54:16

rosetta code has the following solution for assertions (unless (= a 42) (error "a is not 42")) is this how it is usually done?


samth
2021-3-30 13:54:25

Yes