deriv is still not terminating for some reason. need to investigate.

This commit is contained in:
Danny Yoo 2011-05-12 03:20:23 -04:00
parent 6dff02d606
commit 3c2917f0c5
3 changed files with 53 additions and 2 deletions

View File

@ -865,7 +865,7 @@
(ModuleVariable-module-name op-knowledge))
'#%kernel)
(let ([op (ModuleVariable-name op-knowledge)])
(cond [(KernelPrimitiveName? op)
(cond [(KernelPrimitiveName/Inline? op)
(compile-kernel-primitive-application
op
exp cenv target linkage)]
@ -929,7 +929,7 @@
(: compile-kernel-primitive-application
(KernelPrimitiveName App CompileTimeEnvironment Target Linkage -> InstructionSequence))
(KernelPrimitiveName/Inline App CompileTimeEnvironment Target Linkage -> InstructionSequence))
;; This is a special case of application, where the operator is statically
;; known to be in the set of hardcoded primitives.
;;

View File

@ -71,6 +71,8 @@
'eq?))
(define-predicate KernelPrimitiveName/Inline? KernelPrimitiveName/Inline)
(: kernel-primitive-expected-operand-types (KernelPrimitiveName/Inline Natural -> (Listof OperandDomain)))

View File

@ -337,6 +337,55 @@
(test '(letrec ([even? (lambda (x)
(if (= x 0)
#t
(odd? (sub1 x))))]
[odd? (lambda (x)
(if (= x 0)
#f
(even? (sub1 x))))])
(list (even? 1024)
(even? 1023)
(even? 2172)
(even? 2171)))
(list #t #f #t #f))
(test '(letrec-values ([(even? odd?)
(values
(lambda (x)
(if (= x 0)
#t
(odd? (sub1 x))))
(lambda (x)
(if (= x 0)
#f
(even? (sub1 x)))))])
(list (even? 1024)
(even? 1023)
(even? 2172)
(even? 2171)))
(list #t #f #t #f))
(test '(letrec ([fact (lambda (x)
(if (= x 0)
1
(* x (fact (sub1 x)))))])
(list (fact 3) (fact 4) (fact 5)))
'(6 24 120))
;; deriv
(test '(let ()
(define (deriv-aux a) (list '/ (deriv a) a))