(no title)
pg | 6 years ago
(def typecheck ((var f) arg env s r m)
(mev (cons (list (list f (list 'quote arg)) env)
(fu (s r m)
(if (car r)
(pass var arg env s (cdr r) m)
(sigerr 'mistype s r m)))
s)
r
m))
says is, first create a function call (list f (list 'quote arg))
in which the function describing the type (e.g. int) is called on the argument that came in for that parameter. Its value will end up on the return value stack, r. So in the next step you look at the first thing on the return value stack (car r)
If it's true, you keep going as if the parameter had been a naked one, with no type restriction (pass var arg env s (cdr r) m)
and if it's false, you signal an error (sigerr 'mistype s r m)
No comments yet.